I'm trying to run Optimization (using Default and Genetic optimizer) of a simple multi timeframe strategy that I got by converting SampleMultiTimeFrame strategy to optimizable by adding parameters for slow/fast period (attached) and it fails with an error.
Running backtest on this strategy works fine.
Steps to reproduce (NT 8.0.1.0 64-bit):
1. Strategy Analyzer
2. Backtest Type - Optimization
3. Optimizer - Default or Genetic
4. Select MyMultiTimeFrame (attached)
5. set Fast to 2-5, Slow to 5-50
6. configure some instrument and date range
7. hit Run button
Current behavior:
1. Error message in print window:
Strategy 'MyMultiTimeFrame': Error on calling 'OnBarUpdate' method on bar 20: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
================ EXCEPTION ================== 'barsAgo' needed to be between 0 and -1 but was 0 Parameter name: barsAgo at NinjaTrader.NinjaScript.Series`1.get_Item(Int32 barsAgo) at NinjaTrader.NinjaScript.NinjaScriptBase.get_Item(Int32 barsAgo) at NinjaTrader.NinjaScript.Strategies.MyMultiTimeFrame.OnBarUpdate() in c:\Users\luk\Documents\NinjaTrader 8\bin\Custom\Strategies\MyMultiTimeFrame.cs:line 86 =============================================
Thanks for investigating this, it's very important for me!
Lukas
Comment