I have a strategy that worked nicely in 6.5 but is broken in 7.0.0.19, so I've been trying to debug. The strategy uses multiple instruments in the Initialize method and I put a simple print statement in to check if the historical data is loaded correctly. Here's a portion of the code:
protected override void Initialize()
{
Add("ES 12-10", PeriodType.Day, 1);
Add("YM 12-10", PeriodType.Day, 1);
SpreadCloses = new DataSeries(this); // synch dataseries
CalculateOnBarClose = true;
ExitOnClose = false;
EntryHandling = EntryHandling.UniqueEntries;
Add ("YM 12-10", PeriodType.Minute, 1);
Print ("Init Done");
}
protected override void OnStartUp()
{
for (int x = 0; x <stDevPeriod ; x++)
{
Print (" x= "+ x + " NQ = " +Closes[0][x]+ " ES = " + Closes[1][x]+ " YM = "+ Closes[2][x]);
}
}
Init Done
**NT** Enabling NinjaScript strategy 'DEBUGStrategy/634e07b0cef04464aa7f01419f1deb14' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositions ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True MaxRestarts=4 in 5 minutes
x= 0 NQ = 1873 ES = 1096.25 YM = 10316
**NT** Error on calling 'OnStartUp' method for strategy 'DEBUGStrategy/634e07b0cef04464aa7f01419f1deb14': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

Comment