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
ta.hma(source, length) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
| length | simple int | HMA length. |
Returns
Hull moving average of source for length bars back.
Remarks
na values in the source series are ignored.
Code Examples
//@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
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.
Related Pine Script Functions
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.ema() - Exponential Moving Average
Learn how to use ta.ema() in Pine Script. Syntax, parameters, code examples, and trading applications for the Exponential Moving Average function.
ta.wma() - Weighted Moving Average
Learn how to use ta.wma() in Pine Script. Syntax, parameters, code examples, and trading applications for the Weighted Moving Average function.
ta.vwma() - Volume Weighted Moving Average
Learn how to use ta.vwma() in Pine Script. Syntax, parameters, code examples for the Volume Weighted Moving Average.
ta.alma() - Arnaud Legoux Moving Average
Learn how to use ta.alma() in Pine Script. Syntax, parameters including offset and sigma, code examples for ALMA.