I ran into a snag trading a few days ago where I accidentally ended up with 25 open orders at once. My code was basically reading my entry criteria and submitting orders on top of orders because I was checking to determine my total position quantity with Position.Quantity. And this was just specific to one order, and when unfilled it shows up as 0.
So at this point Let's say that I have 5 open orders on different price levels, and I want my code to know that I have 5 total open orders and let's say my entry condition checks to make sure I have less than 5 open orders before submitting any additional orders. What I need is something like this:
If ( Variable I need ) < 5 then Submit order, else Do nothing.
What is the best way to get this? I have tried both Position.Quantity and PositionAccount.Quantity but they they only show me 0 unless I am filled, and then it is only specific to the order used at the time. Is there some sort of global method I can call to see my total unfilled size?
Let me know if there is something out there that can do this.
Thanks,
Ian
Comment