# 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]);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://indicators.agenatrader.com/standard-indicators/moving-averages/hma-hull-moving-average.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
