Skip to content
Algo Trade Analytics Docs

ta.mode() - Pine Script Function

Returns the mode of the series. If there are several values with the same frequency, it returns the smallest value.

ta.mode(source, length) → series int
NameTypeDescription
sourceseries intSeries of values to process.

The most frequently occurring value from the source. If none exists, returns the smallest value instead.

  • na values in the source series are ignored; the function calculates on the length quantity of non-na values.