I have a simple indicator where I want to have RSI line colored in one color or another depending on slop up or down. Why do I get line brakes as in attached figure in the lower indicator window. Here is my code:
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.ForestGreen), PlotStyle.Line, "PlotUp"));
Add(new Plot(Color.FromKnownColor(KnownColor.Tomato), PlotStyle.Line, "PlotDown"));
Add(new Plot(Color.FromKnownColor(KnownColor.SlateGray), PlotStyle.Line, "Plot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.SlateGray), PlotStyle.Line, "Plot100"));
Add(new Line(Color.FromKnownColor(KnownColor.DarkOrange), 50, "ZeroLine"));
Overlay = false;
CalculateOnBarClose = false;
}
/// <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.
if (CurrentBar<PeriodRSI) return;
if (RSI(Input,PeriodRSI,1)[0]>=RSI(Input,PeriodRSI,1)[1])
PlotUp.Set(RSI(Input,PeriodRSI,1)[0]);
else
PlotDown.Set(RSI(Input,PeriodRSI,1)[0]);
Plot0.Set(0);
Plot100.Set(100);
}
Comment