Okay, I’ve gotten myself to the point where all that’s left is to get the proper orders to execute when the prescribed conditions exist. This is proving to be something of an issue.
The first Entry order executes fine. I’ve tried using
NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(atm, entryorder);
and
theAccount.Submit(new[] { entryorder });
They both work, in terms of generating orders, but neither one is suitable for management once I am in a position. The ATM method is problematic because I want to reverse on stop, but then you can never exit a trade without your targets getting hit, because you’re trapped in this neverending loop of reversing positions.
The other method would be preferable, if I could get the SetStopLoss to work, but I always get “does not exist in the current context.” ExitLongStopMarket gives the same error.
So, I am trying to figure out how to get the orders that I can place to execute properly and provide the behavior that I am seeking.
Basically, I want the first order to go in with targets and stops. Then, when price has moved far enough in my direction, move the stop to breakeven.
Simultaneously, I need it to monitor for price moving against me, and then reverse my position if it goes too far.
The reversed position should then behave just like the original entry, minus the stop-and-reverse. I’ve tried doing it by creating multiple orders initially, using a different ATM strategy for each one, but then I end up having to create two orders for the stop-and-reverse, and then I end up with a dozen different orders on my chart.
The main problem with starting with the ATM is that it only sets the stops at a certain distance from the entry, based on what’s specified in the ATM Strategy, but I need to set my initial stop at a particular price, based on market structure. That is where the SetStopLoss or ExitLongStopMarket would come in handy, but they don’t work.
Any suggestions would be greatly appreciated. Thank you!