Profit in points?

 
Please, in the "history" tab, is there any way for the "profit" column to be in points instead of monetary balance?
Files:
Capturar.PNG  8 kb
 

It can be done through a calculation. A script can be made to calculate it automatically.

 
Conor Mcnamara #:

It can be done through a calculation. A script can be made to calculate it automatically.

Thanks for the tip. :)

 

Forum on trading, automated trading systems and testing trading strategies

How to turn profit into profit points?

Caspase, 2023.01.18 00:37

#property copyright "Spase"
#property link      "https://www.mql5.com"
#property version   "1.00"

// Following code calculates the total profit of the open positions for the current symbol or chart only. 
// You can change the RunningProfit function not to exclude other symbols.
// I am an amateur hobyist coder so my code might not look pretty or make sense to seasoned programers, but hey it works.
// I coudn't find a way of including commissions for those who trade with brokers who charge commissions. 

void OnDeinit(const int reason)
  {
   Comment("");
  }

void OnTick()
  {
   double RunningProfitCash = 0;
   int RunningProfitPips = 0;
   
   RunningProfit(RunningProfitCash,RunningProfitPips);
   
   Comment  ("For Current Symbol: ",_Symbol,"\n",
             "Running Profit in Cash: $",DoubleToString(RunningProfitCash,2),"\n",
             "Running Profit in Pips: " ,RunningProfitPips/10,"\n" //Points converted to pips by dividing by 10. Lazy lol
            );
  }


void RunningProfit(double &RunningProfitCash , int &RunningProfitPips )
{
   double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); // Calculate the Ask Price
   double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);// Calculate the Bid Price
   double SinglePositionCurrentProfitPips = 0.0;
   
   for (int i=PositionsTotal()-1; i>=0; i--)//Go through all the positions 
               {
                  string symbol=PositionGetSymbol(i); //Get the current symbol of each position
                     if (_Symbol==symbol) // Include only positions of current symbol on chart. You can omit this if you want total profit of all positions.
                          {
                           double SinglePositionCurrentProfitCash =PositionGetDouble(POSITION_PROFIT)+ PositionGetDouble(POSITION_SWAP);//Get the position profit in Cash
                              if (PositionGetInteger(POSITION_TYPE)==ORDER_TYPE_SELL)
                                 {SinglePositionCurrentProfitPips =PositionGetDouble(POSITION_PRICE_OPEN) - Ask ;//Get the Sell positions profit in price difference
                                   }
                              if (PositionGetInteger(POSITION_TYPE)==ORDER_TYPE_BUY)
                                 {SinglePositionCurrentProfitPips = Bid-PositionGetDouble(POSITION_PRICE_OPEN); //Get the Buy positions profit price difference
                                 }
                           
                           RunningProfitCash = RunningProfitCash + NormalizeDouble(SinglePositionCurrentProfitCash,2); // Adding profits of current symbol positions     
                           RunningProfitPips = RunningProfitPips + int (SinglePositionCurrentProfitPips/_Point); // Divide price difference then convert to points. Then add all profits in points
                           }// End If loop 
               
                 }// End for loop
        RunningProfitCash = RunningProfitCash;
        RunningProfitPips = RunningProfitPips;
 }
This is a code I made as part of a larger expert. It works for your purpose. Hope you find it useful.

Forum on trading, automated trading systems and testing trading strategies

How to turn profit into profit points?

Wisam Abdelazim Ibrahim Mohamed, 2023.08.27 21:31

a small modification give real points of profit


int cs = SymbolInfoDouble(Symbol(),SYMBOL_TRADE_CONTRACT_SIZE);

RunningProfitPips = RunningProfitPips + int (SinglePositionCurrentProfitPips * cs );


 
Ryan L Johnson #:


Thank you very so much my friend! :)