Please read this article here to understand how to deal with open position: https://www.mql5.com/en/articles/7981.
Searching here is a lot faster than waiting here for other that might be interested...

- www.mql5.com
Please read this article here to understand how to deal with open position: https://www.mql5.com/en/articles/7981.
Searching here is a lot faster than waiting here for other that might be interested...
please help me to fix it.. it hard for me to understand oop written program
for ( int i = PositionsTotal()-1 ; i >= 0 ; i-- ) { ulong direction = PositionGetInteger(POSITION_TYPE); string symbol = PositionGetSymbol(i);
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)
for ( int i = PositionsTotal()-1 ; i >= 0 ; i-- ) { ulong ticket_no = PositionGetTicket(i); ulong direction = PositionGetInteger(POSITION_TYPE); string symbol = PositionGetSymbol(i);
PERFECT .. NOW ITS WORKING..

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i want to close only specific directions , and rest will be open,
below i created a function , it take 1 parameter, ( buy, sell, all )
steps to get my view:
step 1: run the EA
step 2: open manual trade : 3 buy and 3 sell
step 3: this EA should close only sell directions, because you written "sell" in the functions
but unfortunately it closes all postions ??? why.. what i'm missing here??
please help