RSI Divergence Indicator: the RSI, plus a labelled plate wherever a fresh RSI
pivot disagrees with the price pivot beside it.
Four signal classes, each comparing the newest oscillator pivot with the one
before it and the price at both:
regular bullish: oscillator higher low against a lower price low;
hidden bullish: oscillator lower low against a higher price low;
regular bearish: oscillator lower high against a higher price high;
hidden bearish: oscillator higher high against a lower price high.
The bookkeeping is all "the previous pivot", said three ways: a pivot low of
the oscillator fires on the bar that confirms it, lbR bars after it
happened; the value-when lookup reads a series as it stood at the pivot before
this one; and the range gate counts the bars since that previous pivot,
rejecting pairs closer together than rangeLower or further apart than
rangeUpper. The gate counts from the found flag delayed one bar, so the
pivot being confirmed right now is not counted as its own predecessor.
Every comparison is fed a missing value until a second pivot exists, and those
comparisons are false, so nothing fires before then without an explicit guard.
Not reproduced: the four connector plots, which join consecutive pivot
readings and go transparent when the divergence does not hold. They need a
line drawn between two isolated points and a per-bar line colour, neither of
which this library's line renderer has. The labels carry the same information.
RSI Divergence Indicator: the RSI, plus a labelled plate wherever a fresh RSI pivot disagrees with the price pivot beside it.
Four signal classes, each comparing the newest oscillator pivot with the one before it and the price at both:
The bookkeeping is all "the previous pivot", said three ways: a pivot low of the oscillator fires on the bar that confirms it,
lbRbars after it happened; the value-when lookup reads a series as it stood at the pivot before this one; and the range gate counts the bars since that previous pivot, rejecting pairs closer together thanrangeLoweror further apart thanrangeUpper. The gate counts from the found flag delayed one bar, so the pivot being confirmed right now is not counted as its own predecessor.Every comparison is fed a missing value until a second pivot exists, and those comparisons are false, so nothing fires before then without an explicit guard.
Not reproduced: the four connector plots, which join consecutive pivot readings and go transparent when the divergence does not hold. They need a line drawn between two isolated points and a per-bar line colour, neither of which this library's line renderer has. The labels carry the same information.