Do you have a better close all function for MT5?
The following function fail to close everything.
It was executed in the expert but at the journal, shows that 2 positions does not exist.
I have 4 opened trades and it only closes 2.
The following function fail to close everything.
It was executed in the expert but at the journal, shows that 2 positions does not exist.
I have 4 opened trades and it only closes 2.
MQL5:
void CloseAll3() { for (int i=PositionsTotal()-1;i>=0; i--) { { if(!trade.PositionClose(PositionGetSymbol(i))) { //--- failure message Print(PositionGetSymbol(i), "PositionClose() method failed. Return code=",trade.ResultRetcode(), ". Code description: ",trade.ResultRetcodeDescription()); } else { Print(PositionGetSymbol(i), "PositionClose() method executed successfully. Return code=",trade.ResultRetcode(), " (",trade.ResultRetcodeDescription(),")"); } } } }