Huseyin Avni Ekmekci:
The condition !i >= 0 is logically incorrect.!i negates the value of i (as a boolean), so the comparison doesn't make sense.
void CloseAllPositions() { CTrade trade; for(int i = PositionsTotal() - 1;i >= 0; i--) { ulong ticket = PositionGetTicket(i); if(PositionSelectByTicket(ticket) && PositionGetInteger(POSITION_MAGIC) == magic_number) trade.PositionClose(ticket); } }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register