Hello Moderators,
I’m working on a NinjaTrader 8 AddOn that dynamically manages the stop on an ATM strategy after the entry order has filled.
We know this type of functionality is possible because there are existing NinjaTrader tools, such as ATR Trade Shield, that dynamically modify ATM stop orders after entry. Our goal, however, is to build our own AddOn because we want a different workflow, including ATR-based stop management and custom profit targets such as a ½ ATR target.
We’ve narrowed the project down to one specific issue and are hoping you can point us toward the recommended implementation.
Current Status
-
We successfully detect the ATM execution.
-
We successfully capture the ATM Stop1
Orderobject. -
We successfully call
account.Change(). -
We have successfully moved the stop once, which confirms that the API path is working.
-
However, the stop moved 10 points in the wrong direction.
-
We then added additional logic to prevent that, but the stop no longer moved. At this point we’re not sure whether that was caused by our logic, replay state, or event timing.
Our Question
Since we’ve already confirmed that we can modify the stop order, what is the recommended way to calculate and apply the new stop price?
Specifically:
-
Should the new stop price be calculated relative to the entry price, the current stop price, or another value?
-
Is there a preferred event in the ATM lifecycle where the stop should be modified to ensure the change is applied reliably?
-
Is there a recommended pattern for updating an existing ATM stop order using
account.Change()?
We’re trying to avoid continuing with trial-and-error when we’re likely just missing the recommended implementation pattern.
If it would help, we’re happy to post the relevant sections of our code showing how we’re capturing the stop order and calling account.Change(). We didn’t want to post several hundred lines of code unless it’s needed.
Thank you for your time and guidance.