This is the code:
protected override void OnBarUpdate()
{
int i;
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
if (ifHistoryScanned == false)
{
Print(Close[0]);
for(i=0; i<=10; i++)
{
if (High[i] > highestHigh)
highestHigh = High[i];
Print(High[i]);
Print(Time[i]);
Print(i);
// If current low is lower than current lowest low, set lowest low to current low
if (Low[i] < lowestLow)
lowestLow = Low[i];
Print(Low[i]);
Print(Time[i]);
Print(i);
}
ifHistoryScanned = true;
}
This is an output:
7740
7740.75
10/7/2019 1:00:00 AM
0
7729.25
10/7/2019 1:00:00 AM
0
7734.75
10/7/2019 12:30:00 AM
1
7698.75
10/7/2019 12:30:00 AM
1
Strategy 'MAcrossingBreakEven': Error on calling 'OnBarUpdate' method on bar 1: 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.
I dont understand why CLose[0] returnes a quote for 7th october
Comment