I'm trying to add slippage to my backtests but struggling and hoping for some help please. I'm running Strategy Analyzer on an instrument list (50 stocks). My primary data series is 1min bars. I've added a secondary dataseries for tick data:
else if (State == State.Configure) { AddDataSeries(BarsPeriodType.Tick, 1); }
EnterLong(barsInProgressIndex:1, quantity:convertedBaseOrderQty, signalName:"BuyLong");
if (State == State.SetDefaults) { Description = @"MVSR Strategy"; Name = "MVSR"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.High; //tried Standard & High Slippage = 50; //tried various settings. StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true;
FYI: My live strategies results have large differences to my backtests (I'm familiar with the reasons for this, such as https://ninjatrader.com/support/help...ime_vs_bac.htm) and I think it's due to a slippage/time delay. E.g. for one particular stock, the backtest shows a $14.47 long entry at 1:03:05PM and a $14.55 exit at 1:38:08PM. In Real-Time I filled at $14.48 at 1:03:05PM (1cent off) and exited at $14.53 at 1:38:08PM (2cents off). Looking at the tick data the slippage was 3-5 ticks on entry, and upto 13 ticks on exit. I need to factor in some form of slippage/time delay into my backtests to help them be more realistic but struggling to add.
Many thanks in advance
ChainsawDR
Comment