Then, I added a 5min dataseries to my strategy using
Error on calling 'OnBarUpdate' method on bar 425: Index was outside the bounds of the array.
for more context, I'll show you the Ichimoku code :
protected override void OnBarUpdate()
{
if (CurrentBar < senkouSpanBPeriod) return;
double tenkanSen = (Highs[0][HighestBar(High, tenkanPeriod)] + Lows[0][LowestBar(Low, tenkanPeriod)]) / 2;
double kijunSen = (Highs[0][HighestBar(High, kijunPeriod)] + Lows[0][LowestBar(Low, kijunPeriod)]) / 2;
double senkouSpanA = (tenkanSen + kijunSen) / 2;
double senkouSpanB = (Highs[0][HighestBar(High, senkouSpanBPeriod)] + Lows[0][LowestBar(Low, senkouSpanBPeriod)]) / 2;
TenkanSen[0] = tenkanSen;
KijunSen[0] = kijunSen;
SenkouSpanA[0] = senkouSpanA;
SenkouSpanB[0] = senkouSpanB;
// Use DrawRegion to fill the area between Senkou Span A and Senkou Span B
// The region will be filled between SSA and SSB on the chart
string regionID = "KumoCloud" + CurrentBar;
Brush outlineColor = new SolidColorBrush(Color.FromArgb(70, 78, 45, 13));
Brush areaColor = new SolidColorBrush(Color.FromArgb(30, 54, 137, 164));
Draw.Region(this, regionID, CurrentBar, 0, SenkouSpanA, SenkouSpanB, outlineColor, areaColor, 100, 26);
}
#region Properties
[Browsable(false)]
[XmlIgnore()]
public Series<double> TenkanSen
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> KijunSen
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> SenkouSpanA
{
get { return Values[2]; }
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> SenkouSpanB
{
get { return Values[3]; }
}

Comment