Skip to main content

ta.highest(source, length) - Highest value

Maximum of source over length bars.

ta.lowest(source, length) - Lowest value

Minimum of source over length bars.

ta.median(source, length) - Median

Middle value when sorted over length bars.

ta.mode(source, length) - Most frequent value

Returns the value that appears most often in the window. Returns NaN if there is a tie.

ta.change(source, length?) - Bar-over-bar change

Current value minus the value length bars ago. length defaults to 1.

ta.barssince(key, condition) - Bars since true

Returns the number of bars elapsed since condition was last true. Requires a unique string key to identify this aggregator’s state across bars.
The key must be unique per call site. If two different ta.barssince calls share the same key, they will interfere with each other’s state. Use descriptive keys like "rsi-crossover-14" rather than "x".

ta.cum(key, value) - Cumulative sum

Returns the running sum of value accumulated since the first bar. Requires a unique string key.

Stateful aggregator keys - budget impact

ta.barssince and ta.cum each consume one slot from the 64-Series budget. Every unique key creates one internal Series. If you have many call sites, keep an eye on the Series count.
Each unique key passed to ta.barssince or ta.cum allocates an internal Series. The total across explicit Series() calls and stateful aggregator keys must not exceed 64.

Pivots

ta.pivothigh / ta.pivotlow - structural aggregators.

Series

Manual Series storage for custom aggregation.

API limits

64-Series budget shared with stateful aggregators.