Hello,
I’m testing a simple partial-profit strategy and seeing that “historical” limit exits don’t fill even when price clearly reaches the targets on the chart.
Setup (NT8):
- Instrument: ES 12-25, 1-Minute, Trading Hours: CME US Index Futures RTH
- Data providers: Kinetick (historical), NinjaTrader Continuum (real-time)
- Chart: Tick Replay = ON, Days to load = 5
- Strategy settings:
Calculate = Calculate.OnEachTickIsExitOnSessionCloseStrategy = falseOrderFillResolution = High,OrderFillResolutionType = Tick,OrderFillResolutionValue = 1- Entries: 2 contracts
- Exits:
- Partial: ExitLongLimit(1, entry + 2 ticks)
- Runner: ExitLongLimit(remaining, entry + 10 ticks)
- Stop: SetStopLoss(entry – StopTicks); moved to breakeven after partial fills
Observed issue (historical only):
- The strategy enters correctly, but the partial and runner
ExitLongLimit()orders never fill in historical processing, even though the bars’ highs reach (and exceed) the target prices.
Minimal code (entry & exits):
if (Position.MarketPosition == MarketPosition.Flat && High[0] > High[1])
EnterLong(Math.Max(2, Qty), "ENTRY-L");
protected override void OnExecutionUpdate(Execution e, string id, double price, int qty,
MarketPosition mp, string orderId, DateTime time)
{
if (e?.Order == null || e.Order.OrderState != OrderState.Filled) return;
if (e.Order.FromEntrySignal == "ENTRY-L" && Position.MarketPosition == MarketPosition.Long)
{
double entry = e.Order.AverageFillPrice;
SetStopLoss("ENTRY-L", CalculationMode.Ticks, StopTicks, false);
ExitLongLimit(1, entry + (2 * TickSize), "PT-P", "ENTRY-L");
ExitLongLimit(Math.Max(0, Position.Quantity - 1), entry + (10 * TickSize), "PT-R", "ENTRY-L");
}
if (e.Order.Name == "PT-P") SetStopLoss("ENTRY-L", CalculationMode.Price, Position.AveragePrice, false);
}
Questions:
- What is the correct approach to get intrabar limit fills (partial + runner) to register in historical backtesting with Tick Replay?
- Is
ExitLongLimit()expected to fill historically with OrderFillResolution=High + Tick Replay, or should I manually detectHigh[0] >= targetand sendExitLong()market orders for historical? - Are there any additional settings (strategy or chart) required so partial fills are simulated correctly on historical data?
- Any known limitations with partial limit orders + breakeven stop adjustments on historical that I should account for?
I can provide the full .cs file and a short video if helpful.
Thanks so much!