Error on calling 'OnBarUpdate' method on bar 347: Index was outside the bounds of the array.
The data series is #1 in the array and is being called via BarsInProgress == 1. The indicator using this same code works fine but when I run this using a strategy it's giving the above error and I'm not sure why.
I'm adding the time and period via int in the ui and it's being loaded with on state.configure like this:
else if (State == State.Configure)
{
AddDataSeries(HTFPeriodType, HTFPeriod);
}
Also I'm sure there is enough data for the strategy to run because it only needs 26 bars and I've set it to 50 which is the same as it was in the indicator version.
if(CurrentBar < 50 || CurrentBars[1] < 50) return;
When it gets to the line in the code if(BarsInProgress == 1) that's when I get the error. I don't see this being a syntax issue. Maybe I can't add a data series that way in a strategy. This is the first time I've created a strategy so I'm assuming this is just a simple oversight. Please assist.
Comment