hma
Hull Moving Average
hma(source, period)
Parameters
Hull Moving Average - hma(source, period)
The Hull Moving Average reduces lag while maintaining smoothness by using
weighted moving averages in a nested calculation. It achieves responsiveness
by weighting recent data and using the square root of the period.
- source (source): Data series to calculate HMA on - price field (close, open, high, low) or indicator output
- period (int): Number of periods for the moving average
- Common values: 9, 16, 20, 50, 200
Formula
HMA = WMA(2 * WMA(n/2) - WMA(n), sqrt(n))
Where:
- n = period
- WMA(n/2) = weighted MA with half period
- WMA(n) = weighted MA with full period
- Final WMA uses sqrt(n) as the period
Examples
hma(close, 9); # 9-period Hull MA (fast, responsive)
hma(close, 20); # 20-period Hull MA (standard)
x = hma(close, 50); close > x; # Price above 50-period HMA
Returns
Hull moving average value with reduced lag compared to traditional MAs