ta.mode() - Pine Script Function
ta.mode()
Section titled “ta.mode()”Overview
Section titled “Overview”Returns the mode of the series. If there are several values with the same frequency, it returns the smallest value.
Syntax
Section titled “Syntax”ta.mode(source, length) → series intParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | series int | Series of values to process. |
Returns
Section titled “Returns”The most frequently occurring value from the source. If none exists, returns the smallest value instead.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.