Ordinary moving averages are smooth but late. Alan Hull designed his moving average to reduce that lag without giving up the smoothness. It is built from weighted moving averages (WMA) in three steps:
HMA = WMA(2 × WMA(price, n/2) − WMA(price, n), sqrt(n))
Because the Hull line turns early, the most useful information it gives is its direction. This indicator makes the direction visible at a glance: the line is drawn in one color while its slope is positive and in another while it is negative, so there is no need to compare values by eye. Optional arrows mark the bar where the slope changes from not-up to up, or from not-down to down.
The calculation is incremental: the applied price and the intermediate series are stored in buffers, and after the first pass only the last bar and new bars are recalculated on each tick.

Fig. 1. HMA(21) on an EURUSD H1 chart with the turn arrows and the slope label. The image is black & white according to the Code Base image guidelines: a rising HMA is shown as a solid line and a falling HMA as a dashed line; on a real chart these are the configurable up and down colors.
| Input | Default | Purpose |
|---|---|---|
| Hull moving average | ||
| InpPeriod | 21 | HMA period n. The fast WMA uses n/2 bars (integer division) and the final smoothing uses round(sqrt(n)) bars. Must be at least 2. |
| InpPrice | PRICE_CLOSE | Applied price: close, open, high, low, median, typical or weighted. |
| Slope | ||
| InpMinSlopePoints | 0.0 | Minimum change of the HMA per bar, in points, for the slope to count as up or down. Smaller changes are treated as flat. With 0.0 any change colors the line. Must not be negative. |
| Colors and signals | ||
| InpColorUp | clrDodgerBlue | Line and arrow color for an upward slope. |
| InpColorDown | clrRed | Line and arrow color for a downward slope. |
| InpColorFlat | clrGray | Line color when the slope is below the minimum. |
| InpShowArrows | true | Shows arrows where the slope turns up or down. |
| InpClosedBarsOnly | true | Draws arrows only on closed bars, so that an arrow never appears and disappears on the live bar. |
| InpShowLabel | true | Shows the text label with the slope state of the last closed bar. |
| InpLabelColor | clrGray | Color of the text label. |
Gold Trend Breakout Lite — educational XAUUSD trend-following EA
Open-source gold EA built on XAUUSD's multi-day trend persistence: H1 Donchian breakout in the direction of the D1 EMA slope, 3×ATR hard stop, break-even at +1R. Fixed lot, one position, no grid, no martingale.
Risk Lot Panel — drag the stop line, read the lot size for your risk percentage
On-chart position-size calculator. Drag the stop line (and optional target line) and the panel shows lots for your risk %, money at risk and reward:risk. Uses OrderCalcProfit, so it is correct for gold, indices, crypto, FX and any account currency.
Kaufman Adaptive Moving Average (KAMA) Ribbon
A ribbon of Kaufman Adaptive Moving Averages with growing Efficiency Ratio periods, drawn in a monochrome gradient, with an on-chart label showing whether the ribbon is bullish, bearish or mixed.
ATR Trailing Stop Line (Chandelier Exit)
ATR Trailing Stop Line (Chandelier Exit): a volatility-based trailing stop that hangs below the highest high in an up-trend and rises above the lowest low in a down-trend, with trend-flip arrows, an on-chart status label and optional alerts.