talib.mode

Of the last length values of source, this reports the one that recurs most often. It is a statistical mode over a moving window, and it returns a series float like the other window functions here.

talib.mode(series float source, series int length) → series float
ParameterTypeRequiredDescription
sourceseries floatyesThe series whose values are counted.
lengthseries intyesHow many bars the window covers.

Returns series float — A series float: the most frequently occurring value in the window. Where two or more values occur equally often, the smallest of them is returned.

indicator("Modal close of 20 bars")
plot(talib.mode(close, 20))

See also talib.alma · talib.atr · talib.barssince

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade