This is regarding the tutorial indicator "CustomROC".
I was able to code it just fine.
However, for the life of me, I can not see the logic which (if ROC < 0 then plot RED else plot GREEN) allows for the plotting of red and green.
Can someone please shine a light on this for me?
Thanks in advance,
Ron
-----------------------------------------------------------------------------------------------------------------------
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "AboveZero"));
Add(new Plot(Color.FromKnownColor(KnownColor.OrangeRed), PlotStyle.Line, "BelowZero"));
Add(new Line(Color.FromKnownColor(KnownColor.Black), 0, "ZeroLine"));
CalculateOnBarClose = true;
Overlay = false;
Plots[0].Min = 0;
Plots[1].Max = 0;
}
/// <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 < Period) return;
AboveZero.Set(ROC(Period)[0]);
BelowZero.Set(ROC(Period)[0]);

Comment