Error on calling 'OnStateChange': 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.
This is my code
OnStateChange
----------------------
Description = @"Enter the description for your new custom Strategy here.";
Name = "Strategy Name";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = true;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;
=======================
State.Configure
-------------------------
double d = Stochastics(14, 14, 3).D[0];
double k = Stochastics(14, 14, 3).K[0];
=============================
OnBarUpdate
----------------------------
if (CurrentBar < 1) return;
and then just my trade executions

Comment