I know that if I run the same strategy on say, 4 different ES charts (ie. 2-min, 5-min, 30-min, 60-min), but I want to open a position in any of those charts only when I am flat in my account, I would use PositionAccount.MarketPosition == MarketPosition.Flat before entering a position. That way, there would be no possibility of me accidentally going short ES on one chart while being long in another (and thus ending up flat altogether).
However, what if I want to add 4 more charts with this same strategy but on a different instrument? Let's say oil (CL). Now, I would want to know, before opening a position, whether I was flat IN THAT PARTICULAR INSTRUMENT. How would I go about doing this? What would be the line of code that would query my ACCOUNT market position for a specific instrument?
Thank you in advance! This forum is great!
Comment