Moving AveragesPine Script v6

ta.hma()Hull Moving Average

Computes the Hull Moving Average (HMA), designed to reduce lag while keeping the line smooth by combining weighted moving averages with a square-root length step. Useful when you want a responsive trend line.

TradingView language reference

Syntax

Syntax
ta.hma(source, length) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries of values to process.
lengthsimple intHMA length.

Returns

Hull moving average of source for length bars back.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("Hull Moving Average")
src = input(defval=close, title="Source")
length = input(defval=9, title="Length")
hmaBuildIn = ta.hma(src, length)
plot(hmaBuildIn, title="Hull MA", color=#674EA7)

Trading Applications

Minimize lag while maintaining smoothness

Compare turning points with other averages on the same data

Use for fast-moving market scalping strategies

Combine with other MAs for crossover signals

Frequently Asked Questions

ta.hma() is the built-in Hull Moving Average. It applies WMA steps (including half-length and sqrt-length phases) to approximate the current trend with less lag than a plain SMA of the same nominal length.

The Hull construction combines weighted averages to reduce smoothing lag. This does not guarantee earlier correct reversal signals or better noise filtering on every price path.

Common uses include slope and direction of the HMA (up vs down), price relative to HMA for bias, and crossovers between HMA and price or another MA. Always validate signals with your timeframe and risk rules.

Generate ta.hma() Code with AI

Draft Pine Script using ta.hma() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.