Is this code outdated in MQL5 Counting the number of long Position, Please help me look into it. thanks
- Learn how to design a trading system by ADX
- FileWriteArray
- ExpertRemove
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
You are counting orders not positions.
MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016) -
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderType() == OP_BUY)
You are using MQL4 trade functionality. It will not work in MQL5.
Use William Roeder's suggestions in his post #1 for alternative MQL5 code ... "MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)"
Use William Roeder's suggestions in his post #1 for alternative MQL5 code ... "MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)"
Thank you sir, I will look into it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use