I'm building a indicator that have a line called "Maximo", and I want that when the value of "Maximo" is equal to the value of the MACD, a new variable called "IgualMax" worth the same as "Maximo".
I tried to program it but it gave me errors. I hit the code to see if you can help me.
protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Minimo")); Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Maximo")); Add(new Plot(Color.FromKnownColor(KnownColor.GreenYellow), PlotStyle.Line, "IgualMax")); Add(new Line(Color.FromKnownColor(KnownColor.MediumBlue), 0, "Cero")); Overlay = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { double Macd = MACD(Close, 12, 26, 9) [0]; if(Maximo[0]==Macd) { IgualMax = Maximo[0]); } else { IgualMax = 0; } // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. Minimo.Set(MACD(Close,12,26,9) [LowestBar(MACD(Close,12,26,9), Perios)]); Maximo.Set(MACD(Close,12,26,9) [HighestBar(MACD(Close,12,26,9), Perios)]);
I think that the problem is specifically here:
if(Maximo[0]==Macd) { IgualMax = Maximo[0]); } else { IgualMax = 0; }
Thank you very much for your help, and sorry for my bad english level.
Comment