HMA (Function)
The HMA function calculates the Hull Moving Average..
Syntax
HMA(Price,Length)
Returns (Double)
A numeric value for the current bar.
Parameters
Name |
Type |
Description |
Price |
Numeric |
Specifies which bar value (price, function, or formula) to use. |
Length |
Numeric |
Sets the number of bars to consider. |
Remarks
The HMA function is typically used to provide a moving average that responds faster to changes in trend direction while maintaining a smooth curve.
HMA = WAverage( 2 * WAverage( Price, IntPortion( Length * 0.5 ) ) - WAverage( Price, Length ), IntPortion( SquareRoot( Length ) ) )
The input parameter Price can be a bar value such as Close, High, Low, Open, or Volume. It can also be any mathematical calculation such as (High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.
The value for the Length input parameter should always be a positive whole number.
Examples
Assigns the 9 bar Hull moving average of the Close to Value1, then plots Value1:
Value1 = HMA(Close,9);
Plot1(Value1, "AvgClose");