Thanks for your notes.
The error message 'Cancellation rejected by the Order Management System - Order is complete.' means that you tried to cancel an order that was already complete.
Order objects should be tracked in OnOrderUpdate() and OnExecutionUpdate() and before calling CancelOrder() you should check if the Order object is not null as seen in the SampleCancelOrder reference sample.
SampleCancelOrder: https://ninjatrader.com/support/help...thod_to_ca.htm
Note from the SetStopLoss() and SetProfitTarget() help guide documentation:
SetStopLoss(): The signal name generated internally by this method is "Stop loss" which can be used with various methods such as BarsSinceExitExecution(), or other order concepts which rely on identifying a signal name
SetProfitTarget(): The signal name generated internally by this method is "Profit target" which can be used with various methods such as BarsSinceExitExecution(), or other order concepts which rely on identifying a signal name
You could consider using Exit methods for your stop loss and profit target orders instead of Set methods. An example of using Exit methods can be seen in the SampleCancelOrder reference sample.
As stated in my previous post, SetStopLoss() and SetProfitTarget() should be reset when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position. This is noted on the SetStopLoss() and SetProfitTarget() help guide documentation.
NinjaScript strategies cannot see manually placed orders so it is not suggested to place manual orders on the same account/instrument that the NinjaScript strategy is running on. A NinjaScript strategy is only able to see orders that the specific strategy instance places.
Use prints to understand how the logic is the strategy is behaving.
https://ninjatrader.com/support/foru...121#post791121

Comment