Hi. This function is necessary, the expert Advisor increases the catch depending on the profit, but when a certain amount is reached, it resets the lot to the initial one and everything starts over again.
I did it like this:
for(int pr=OrdersHistoryTotal()-1;pr>=prstop;pr--)
{
if (profitclots < depo)
{
profitclots += (OrderProfit()+OrderCommission()+OrderSwap());
GetLots();
}
if (profitclots > depo)
{
profitclots =0;
GetLots();
prstop = (OrdersHistoryTotal()-1);
}
}
Counts, resets, but! When the order type changes, the profit becomes negative. If the orders are all of the same type, then all are good.
Tell me where to dig?
iks_
It is not better to look at the closing time rather than the number in the history array.