if you run this strategy as a Walk Forward Test from 2010 - present, on any Forex instrument, using an OptimizationPeriod greater than 30, the walk forward test crashes on the first iteration and returns no results. The crashing seems to be related to the fact that the strategy has no exits.
- If you add an exit condition, it does not crash.
- If you use an OptimizationPeriod of 30 or less, it does not crash.
- If you test against a non-Forex instrument it does not crash.
I know you're going to ask for log and trace files, but I already checked them and there's nothing unusual; no reported errors or crashes in either file. To reproduce the issue, please run my test strategy against a Forex instrument with an OptimizationPeriod > 30.
namespace NinjaTrader.NinjaScript.Strategies { public class Test : Strategy { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "Test"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; 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; MyParameter = 1; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { EnterLong(); } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="MyParameter", Order=1, GroupName="Parameters")] public int MyParameter { get; set; } #endregion } }
Comment