I have a big problem with the quantities associated with stoploss.
I'm using my written strategy for Ninjatrader 7, managed approach.
The strategy accepts multiple entries, each with Quantity = 10.
After the fill of each input, I set the stop with SetStopLoss (in the OnOrderUpdate when OrderState = Filled), specifying the name of the associated input, for example: SetStopLoss ("LongFlat_0", CalculationMode.Ticks, LongFlatTicks, false).
In the log I see the stoloss accepted with quantity = 10.
When a second entry named "LongCross_0" arrives, something strange happens:
the stoploss associated with the first entry is automatically changed, I think it is recalculated based on the new AvgFillPrice, why?
But the most serious thing is that his quantity is 20 and not 10!
Then the stoploss associated with the second input is accepted, correctly with quantity = 10.
This causes a serious problem in case the stoploss is reached: the 20 long contracts will be closed but the 10 remaining stops will generate 10 short entries!
(as it happened a few days ago).
Am I doing something wrong? What should I do to avoid this problem?
This doesn't happen in backtest, only in realtime.
The parameter "Stop & target submission" is settted to "By Startegy Position".
Thanks
Carlo
Attached is today's log.
Comment