code help
- www.mql5.com
Try it.
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
Try it.
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
I think the problem remains the fact that some trades history has been removed from the terminal pool. For accounts with short time of activities, the deposit will be there but when there are too many order history or the account has been opened for long time, the initial deposit will not be seen in the terminal.
How do i work around this? I know that Metaquotes always get this history for calculation of account growth, Maximum DrawDown, Distribution and other Calculations. I think since they can get this from my Trading Account details, there should be a way of getting initial deposit and all other info from my account if it is no longer listed in the trading terminal.

