I place an entry order onBarUpdate with EnterLongStopMarket(quantity, High[0] + (entryOrderBuffer * TickSize), "Long" + Instrument.FullName);
In State.Configure I have SetTrailStop(CalculationMode.Ticks, trailStopBuffer);
The price enters at 308.65 (on the close price of today's 5 minute NFLX bar to test). A few seconds after entry the strategy is disabled because a stop cannot be placed above the market. Sell 100 StopMarket @ 330.31.
I have no idea why SetTrailStop (where trailStopBuffer is set as an input = 20) would cause the trailing stop to be ahead of the price by so much. Please help.
19/08/2019 14:34:59 Strategy 'Gapper/176824384': Entered internal SubmitOrderManaged() method at 19/08/2019 14:34:59: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=100 LimitPrice=0 StopPrice=308.65 SignalName='LongNFLX' FromEntrySignal=''
Strategy 'Gapper/176824383' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
19/08/2019 14:35:34 CancelAllOrders: BarsInProgress=0
Disabling NinjaScript strategy 'Gapper/176824383'
As a second question, if I wanted to trail the stop at the previous candle High[0] could I do this onBarUpdate?
Thanks,
Stefan
Comment