I'm trying to open 2 orders at the same time when a price is reached.
I'm developing in Simulated Data Feed, with instrument FDAX 06.
When I try to open these 2 orders simultaneously, then only the Long Stop Order is taken into account by NinjaTrader 7, but not the Short Stop Order.
The code I use is the following :
string signalNameAchat = "12450" + ";" + "1" + ";" + "LONG"; IOrder orderAchat = this.EnterLongStop((int)10, 12460, signalNameAchat); this.SetProfitTarget(signalNameAchat, CalculationMode.Price, 12470); this.SetStopLoss(signalNameAchat, CalculationMode.Price, 12450, false); string signalNameVente = "12450" + ";" + 1 + ";" + "SHORT"; IOrder orderVente = this.EnterShortStop((int)10, 12300, signalNameVente); this.SetProfitTarget(signalNameVente, CalculationMode.Price, 12250); this.SetStopLoss(signalNameVente, CalculationMode.Price, 12350, false);
Here is the code in the Initialize() function :
protected override void Initialize() { this.BarsRequired = 0; CalculateOnBarClose = false; this.EntriesPerDirection = 8; this.BarsRequired = 0; this.RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction; this.StrategySync = StrategySync.SubmitImmediately; }
Comment