Please use my attached strategy as a demo. For my test, I used SPY as the primary instrument, 30 minute bars from 1/1/2016 - 1/1/2018.
When running a multi-instrument strategy, TimeInForce is set to Day, and ExitOnSessionClose is False, there seems to be a problem entering positions in the secondary instrument due to EntriesPerDirection. It is as if the strategy is seeing phantom positions in the secondary instrument.
Running my strategy, it prints an output every time conditions are met to go long in the secondary along with a counter (i.e. "Test - Should Have Entered #332"). This is very different to the number of trades seen in the Strategy Analyzer, which suggests that EnterLong is being called but nothing is being executed because the EntriesPerDirection rule is being violated. This shouldn't be the case though, as the secondary has a separate, unique string. This also doesn't seem to affect the primary instrument.
It seems that this problem can be overcome by setting EntriesPerDirection to some very high value (e.g. 10,000), by setting TimeInForce to Gtc, by setting ExitOnSessionClose to true, or by using day bars instead.
It also seems that the phantom positions are being taken when an order is placed on the 4:00 pm bar (note, using US Equity RTH) such that it should be entered at the open of the next bar/day. It's fine if the trade is not taken seeing as TimeInForce is Day, but it seems weird that it occupies a phantom position and therefore blocks further entries.
Comment