Figured out that I'm using the wrong function. For anyone else who is having this problem see: PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Documentation on MQL5: Trade Functions / PositionsTotal
- www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Macintyre Sunde #:
Figured out that I'm using the wrong function. For anyone else who is having this problem see: PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Figured out that I'm using the wrong function. For anyone else who is having this problem see: PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
You have to select the order first
Select the order first
Macintyre Sunde :
Carefully study the basic terms: what is a "pending order" (OrdersTotal) and what is a "position" (PositionsTotal)!
Returns the number of open positions | |
Returns the number of orders |
Documentation on MQL5: Trade Functions / PositionsTotal
- www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
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
I am trying to backtest an expert advisor and limit the number of pending orders to 1. However, when I place an order using the CTrade class, OrdersTotal() is still returning 0. I found this forum post but to no avail.
Here's the function I'm running and the output: