I am discovering your platform and am faced with a difficulty that I cannot resolve with the error message:
Error on calling 'OnStateChange' method: Added Plots or Lines must have a unique name.
However, when reading my code, everything seems correct to me while only "band_bottom" value is displayed in Bnd_Top[ !
Please explain to me where the problem is:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
...
AddPlot(Brushes.Yellow, "Bnd_Top");
AddPlot(Brushes.Blue, "Bnd_Bottom");
protected override void OnBarUpdate()
{
if (CurrentBar < 51)
return;
double band_top = -9999999999;
double band_bottom = 9999999999;
for (int i = 1; i < 5; i++)
{
int z = periode_ema + (i * 3);
double emaValue = EMA(Open, z)[0];
if (emaValue > band_top)
{
band_top = emaValue;
}
if (emaValue < band_bottom)
{
band_bottom = emaValue;
}
}
Print(Time[0]+" "+band_top +" "+band_bottom);
Bnd_Top[0] = band_top;
Bnd_Bottom[0] = band_bottom;
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> Bnd_Top
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> Bnd_Bottom
{
get { return Values[0]; }
}
#endregion
Thank you for your help

Comment