# HMA - Hull Moving Average

#### Description <a href="#description_63" id="description_63"></a>

The Hull Moving Average, invented by Alan Hull, is a fast-working moving average that gets rid of almost all delays/lags (zero lag). The calculation is carried out using several weighted moving averages, thereby partially reducing the smoothing effect. Hull’s methodology uses square roots of the period instead of the actual period itself.

#### Interpretation <a href="#interpretation_32" id="interpretation_32"></a>

The same interpretations as for the moving averages apply to the HMA, the only major distinction being the reduced lag. See [*Moving Averages*](https://agenatrader.github.io/AgenaIndicator-documentation/indicators_oscillators/#moving-averages).

#### Usage <a href="#usage_64" id="usage_64"></a>

```csharp
HMA(int period)
HMA(IDataSeries InSeries, int period)
HMA(int period)[int barsAgo]
HMA(IDataSeries InSeries, int period)[int barsAgo]
```

#### Return value <a href="#return-value_61" id="return-value_61"></a>

**double**

When using this method with an index (e.g. **HMA**(21)\[**int** barsAgo] ), the value of the indicator will be issued for the referenced bar.

#### Parameters <a href="#parameters_54" id="parameters_54"></a>

inSeries Input data series for the indicator

period Number of bars included in the calculations

#### Visualization <a href="#visualization_58" id="visualization_58"></a>

![HMA - Hull Moving Average](https://agenatrader.github.io/AgenaIndicator-documentation/media/HMA.jpg)

#### Calculation <a href="#calculation_4" id="calculation_4"></a>

```csharp
double value1 = 2 * WMA(InSeries, (int)(Period / 2))[0];
double value2 = WMA(InSeries, Period)[0];
diffSeries.Set(value1 - value2);
Value.Set(WMA(diffSeries, (int) Math.Sqrt(Period))[0]);
```

#### Example <a href="#example_60" id="example_60"></a>

```csharp
//Output the value for the HMA
Print("The current HMA value is " + HMA(21)[0]);
```
