trying to set a plot to transparent so i only see it on certain conditions, the commented section just Hides both plots. Any ideas how i accomplish this thanks
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.MediumBlue), PlotStyle.Line, "LongProfitTarget"));
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ShortProfitTarget"));
Overlay = true;
}
/// <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.
LongProfitTarget.Set(Close[0]+ATR(5)[0]);
ShortProfitTarget.Set(Close[0]-ATR(5)[0]);
// if ((SMA(18)[0] >= SMA(18)[1]
// && SMA(9)[0] >= SMA(9)[1])
// && (SMA(18)[1] < SMA(18)[2] ||
// SMA(9)[1] < SMA(9)[2])
// && (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
//
// PlotColors[0][0] = Color.MediumBlue;
// else
// PlotColors[0][0] = Color.Transparent;
//
// if ((SMA(18)[0] <= SMA(18)[1]
// && SMA(9)[0] <= SMA(9)[1])
// && (SMA(18)[1] > SMA(18)[2] ||
// SMA(9)[1] > SMA(9)[2])
// && (ADX(14)[0]>16 || CrossAbove(ADX(14), 16, 10)))
//
// PlotColors[1][0] = Color.Orange;
// else
// PlotColors[1][0] = Color.Transparent;
}
Comment