Kan Kan :
PositionGetInteger( POSITION_TYPE ) returns 0, when the function fail, and when the position type is BUY.
the coding result always returns 0, regardless of buy position, sell position.
How to correct this problem?
You must abandon the construction:
bool select=PositionSelect(_Symbol);
you need to go through all positions in the loop:
for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties

How to start with MQL5
- 2020.03.12
- www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
thanks, i will try.

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
PositionGetInteger(POSITION_TYPE) returns 0, when the function fail, and when the position type is BUY.
the coding result always returns 0, regardless of buy position, sell position.
How to correct this problem?