I thought it would be useful to have the Avg live (%D) change color when it goes up and down. While my changes compile without any errors and I have the option to change the color for the Avg line, the line remains one solid color.
I have attached a copy of the script and have summarized my changes below:
Inserted the following into Variables (lines 30 & 31)
private Color uptickAVG = Color.Green;
private Color downtickAVG = Color.Red;
// Plots AVG color when rising or falling
if (Rising(MACD(fast, slow, smooth).Avg))
{
PlotColors[0][0] = UptickAVG;
}
else if (Falling(MACD(fast, slow, smooth).Avg))
{
PlotColors[0][0] = DowntickAVG;
}
[XmlIgnore()]
[Description("Color for MACD Avg when rising")]
[Category("Plots")]
[Gui.Design.DisplayNameAttribute("Avg Up Color")]
public Color UptickAVG
{
get { return uptickAVG; }
set { uptickAVG = value; }
}
[Browsable(false)]
public string UptickAVGSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(UptickAVG); }
set { UptickAVG = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
[XmlIgnore()]
[Description("Color for MACD Avg when falling")]
[Category("Plots")]
[Gui.Design.DisplayNameAttribute("Avg Down Color")]
public Color DowntickAVG
{
get { return downtickAVG; }
set { downtickAVG = value; }
}
[Browsable(false)]
public string DowntickAVGSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(DowntickAVG); }
set { DowntickAVG = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
I should be grateful if someone would look at my code and let me know what I am missing.
Thanks,
Richard

Comment