I’m sick of OnPositionUpdate in my indicator not triggering when a position changes, so I’ve decided to just go ahead and try converting my Indicator(s) to a Strategy.
My first inclination is to just create an effectively blank Strategy, and then cut-and-paste my Indicator code into the Strategy. I’m sure, however, that that won’t work. And I’m also worried about how the new Strategy will interface with Chart Trader and my trade copier.
The reason I have been using an Indicator and not a Strategy is because the Indicator creates a Chart Trader Order, which is then copied by the trade copier and placed for the sub-accounts. And then, whatever changes I make to the order on Chart Trader are magically effected to the sub-account’s orders. I don’t want to break that.
I have seen people recommending to leave the Indicator alone, and just pass data from it to the Strategy, but the Indicator already creates an order.
ChartControl.Dispatcher.InvokeAsync((Action)(() =>
{
myAccount = ChartControl.OwnerChart.ChartTrader.Account;
int qty = ChartControl.OwnerChart.ChartTrader.Quantity;
AtmStrategy atm = ChartControl.OwnerChart.ChartTrader.AtmStrategy;
Instrument instr = ChartControl.OwnerChart.ChartTrader.Instrument;
o = myAccount.CreateOrder(instr, OrderAction.Sell, OrderType.StopMarket, OrderEntry.Automated, TimeInForce.Day, qty, 0, oldBoxLow - RRR, "", "Entry", Core.Globals.MaxDate, null);
NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(atm, o);
}));
So, it would seem to me that just making it a Strategy, thereby giving it all of the abilities that Strategies natively have to track account events, would solve my immediate problem. And it would eliminate the complexities of having to pass whatever information out of the Indicator because, not being an Indicator that uses AddPlot, there are different variables required and calculations that are done only when the Indicator’s conditions are met.
Are there any recommendations or suggestions on how to avoid the pitfalls that I am likely to encounter during the process? Any help would be greatly appreciated!