Chande Momentum Oscillator — the same up/down split as RSI, but as a plain
ratio of summed moves instead of a Wilder average, so it swings the full
-100..100 rather than compressing towards the middle.
change is na on the first bar, so the first published value is the one
backed by length real changes: index length, not length - 1. The sums
are therefore taken over the series from bar 1 onwards, which also keeps the
running total in rollingSum from ever touching a NaN — one NaN would poison
it for the rest of the series, because subtracting it back out when it leaves
the window does not undo it.
Chande Momentum Oscillator — the same up/down split as RSI, but as a plain ratio of summed moves instead of a Wilder average, so it swings the full -100..100 rather than compressing towards the middle.
changeisnaon the first bar, so the first published value is the one backed bylengthreal changes: indexlength, notlength - 1. The sums are therefore taken over the series from bar 1 onwards, which also keeps the running total inrollingSumfrom ever touching a NaN — one NaN would poison it for the rest of the series, because subtracting it back out when it leaves the window does not undo it.