I cannot understand, why it does not work? Сan you help me? protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Plot1"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot2"));
Add(new Line(Color.FromKnownColor(KnownColor.Gold), 0, "ZeroLine"));
Overlay = false;
//BarsRequired =6;
string Instr1Name =Instruments[0].FullName;
Add(Instr1Name,PeriodType.Minute,1,MarketDataType.Ask);//Ask1)
Add(nameOfSecondInstr,PeriodType.Minute,1, MarketDataType.Bid);//Bid2
Add(nameOfSecondInstr,PeriodType.Minute,1, MarketDataType.Bid);//Ask2)
Add(Instr1Name,PeriodType.Minute,1,MarketDataType.Bid);//bid1)
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
Print(Closes[0].ToString()+Closes[0].IsValidPlot(0).ToString());
Print(Closes[1].ToString()+Closes[1].IsValidPlot(0).ToString());
Print(Closes[2].ToString()+Closes[2].IsValidPlot(0).ToString()); //#Error on calling 'OnBarUpdate' method for indicator 'A1MySprend2' on bar 0: 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.
Print(Closes[3].ToString()+Closes[3].IsValidPlot(0).ToString());
Plot1.Set(1);
Plot2.Set(2);
}
//#Error on calling 'OnBarUpdate' method for indicator 'A1MySprend2' on bar 0: 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