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
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: