HMA (Hull MA)

Modified on 2008/03/16 11:16 by Eugene — Categorized as: Community Indicators

Hull MA (HMA): Indicator Documentation

====Syntax====
DataSeries HullMA( DataSeries Series, int Period);

Parameter Description

Series  Data series used to produce the HMA calculation
Period  Period to average the data series

Description

The Hull Moving Average (HMA) was created by trader, businessman, mathematician, and IT expert Alan Hull. It is a combination of weighted moving averages (WMA) designed to be more responsive to current price fluctuations while still smoothing prices.

Alan Hull's description of HMA

Example

This example illustrates how to construct and plot the HMA.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class HullMA : DataSeries { public HullMA ( DataSeries ds, int period ) : base(ds, "HullMA") { DataSeries SlowWMA = WMA.Series( ds, period ); DataSeries FastWMA = WMA.Series( ds, (int)(period/2) ); DataSeries hma = WMA.Series( ( FastWMA + ( FastWMA - SlowWMA ) ), (int)Math.Sqrt(period) ); for (int bar = period; bar < ds.Count; bar++) { this[bar] = hma[bar]; } }

public static HullMA Series( DataSeries ds, int period ) { HullMA _hma = new HullMA( ds, period ); return _hma; } }

public class HMAStrategy : WealthScript { private StrategyParameter paramPeriod; public HMAStrategy() { paramPeriod = CreateParameter( "Period", 20, 2, 100, 1 ); } protected override void Execute() { HullMA hma = new HullMA( Close, paramPeriod.ValueInt ); PlotSeries( PricePane, hma, Color.Blue, WealthLab.LineStyle.Solid, 1 ); } } }