OrderProfit() function removed from MQL5

 

to calculate total profit of all open orders:

double totalprofit;
for(int a=0;a<OrdersTotal();a++)
if(OrderSelect(a,0,0))
totalprofit+=OrderProfit(); 

But the above code only work for MT4/ MQL4

How to code in MQL5 instead ?

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

Please read the following article to better understand how MetaTrader 5 handles the trading functions ...

Articles

Orders, Positions and Deals in MetaTrader 5

MetaQuotes, 2011.02.01 16:13

Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
I also recommend that you read ... MQL5 programming for traders - Book on MQL5.com
MQL5 programming for traders - Book on MQL5.com
MQL5 programming for traders - Book on MQL5.com
  • www.mql5.com
Modern trading relies heavily on computer technology. Automation now extends beyond the boundaries of exchanges and brokerage offices, becoming...