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.

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

Identify trend reversals earlier than traditional MAs

Use for fast-moving market scalping strategies

Combine with other MAs for crossover signals

Frequently Asked Questions

Generate ta.hma() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.hma() and other built-in functions instantly.