I have two strategies for trading the same security (eg: EURUSD on a short term and on a long term strategy). I want them to work independently, without knowledge or consideration as to what the other strategy is doing. Ie, I don't mind doubling my risk, or having my two strategies make equal, opposing trades (since they'll close out at different times anyway).
My problem is that I use "Position.MarketPosition == MarketPosition.Flat" as a condition to ensure that each strategy handles only one trade at a time.
As a result, when strategy A is long EURUSD, strategy B cannot trade, since the account is not "flat" EURUSD. This is because Position.MarketPosition == MarketPosition.Flat is a reference to the account position.
In light of these facts, it becomes clear that Position.MarketPosition == MarketPosition.Flat is not a valid mode of position control when running two strategies side by side trading the same security.
I would like to know how I can programme my two strategies to run side by side on the same security without one interrupting the other. Is it possible? As alternatives to "Position.MarketPosition == MarketPosition.Flat", I have tried using Position.Quantity and Variables0-9 to determine if the strategy has traded, but neither seems to work (since Variable0 is undefined at the beginning of a loop, and for some strange reason, position.quantity work).
Comment