Skip to main content
compute’s third argument, hp, bundles common technical analysis functions. Series helpers take and return Array<number | null> aligned to the input. null means “no value yet”, so check for it before doing arithmetic. Anything else is ordinary JavaScript. Write your own loops and math freely.

Pivots are reported at the pivot bar

Pine reports a pivot right bars after it happens. hp.pivothigh and hp.pivotlow put the value at the pivot bar. A pivot at index p is only known from bar p + right onward, so account for that in signal logic.

Recursive averages need warm-up

hp.atr, hp.rma and hp.ema match TradingView once they have about 10× their length in bars. With long lengths, compare values away from the first bars on the chart.

Using helpers on another timeframe

Run helpers on h.bars from request.bars, then map the result to chart bars with h.align:

Example: crossover markers