ta.mode()
Mode
Returns the mode (most frequent value) of a series over a given number of bars.
Syntax
ta.mode(source, length) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
| length | series int | Number of bars in the rolling window. |
Returns
Mode of source for length bars back.
Remarks
na values in the source series are ignored.
Code Examples
//@version=6
indicator("ta.mode", overlay=true)
plot(ta.mode(close, 30))Trading Applications
Find the most frequent price level (potential support/resistance)
Identify price clustering zones
Build volume profile-like analysis
Detect consolidation price levels
Frequently Asked Questions
Generate ta.mode() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.mode() and other built-in functions instantly.
Related Pine Script Functions
ta.median() - Median
Learn how to use ta.median() in Pine Script. Calculate the median value for robust price analysis.
ta.sma() - Simple Moving Average
Learn how to use ta.sma() in Pine Script. Syntax, parameters, code examples, and trading applications for the Simple Moving Average function.
ta.percentrank() - Percent Rank
Learn how to use ta.percentrank() in Pine Script. Calculate percentile ranking of current value.
ta.highest() - Highest Value
Learn how to use ta.highest() in Pine Script. Find the highest value over a lookback period for Donchian Channels.
ta.lowest() - Lowest Value
Learn how to use ta.lowest() in Pine Script. Find the lowest value over a lookback period.