I've drafted a strategy that utilizes specific entry criteria and then takes an entry using an existing ATM strategy. I've introduced a few safeguards to avoid taking multiple trades, such as confirming our position is flat and checking for an active ATM strategy before proceeding with checking our entry criteria.
Unfortunately, this bug I've been facing has persisted - whenever I initiate this strategy on a live chart, it enters a Buy/Sell loop as soon as an entry is confirmed by my entry criteria. It should only be initiating one entry, but for some reason it tries to initiate an infinite amount. This happens with 'Set Order Quantity' set at 'Strategy' and 'Default Quantity: 1'. I've set 'Entries per Direction' at 1 as well, the issue persists.
This issue seems to happen immediately when an entry is triggered on a live connection (NinjaTrader 8, Rithmic data connection) or completely randomly when testing using Playback mode. On Playback it mostly runs fine, but once in a blue moon the same entry loop will be triggered with seemingly no difference in the strategy/entry criteria.
Entry criteria, if it matters:
Long -
* fastSMA is above slowSMA
* price is above fastSMA
* previous bar or the bar before that opened above the fastSMA and closed red
* current bar is green and has surpassed the preceding red bar to the upside
Short - exact opposite
* fastSMA is below slowSMA
* price is below fastSMA
* previous bar or the bar before that closed below the fastSMA and closed red
* current bar is red and has surpassed the preceding green bar to the downside
I am pasting my entire strategy code below, as well as a screenshot of the corresponding strategy setup window.
*deleted*
Comment