Moving average variation

HMA Bollinger Bands: replace the slow basis, then test the tradeoff

HMA Bollinger Bands use a Hull Moving Average as the center line while the outer bands still measure price dispersion. The change makes the basis react faster, but it also changes every crossover and band-distance reading.

Direct answer

Use HMA Bollinger Bands when you want a more responsive basis than the standard SMA. Keep the HMA length, deviation window, and multiplier separate in your test so you can see which change affects the result.

Starting values

Starting length

20 bars

Basis

HMA

Band distance

2 standard deviations

Price source

Close

How I test the setup

  1. 1

    When I compare HMA and SMA bands on SPY, I keep the length and deviation multiplier fixed. That isolates the basis change.

  2. 2

    I record signals only after the bar closes. An intrabar cross can disappear before the candle is complete.

  3. 3

    I test trend continuation and mean reversion as separate rule sets because a faster center line can affect them in opposite ways.

How HMA changes the standard Bollinger Bands formula

Standard Bollinger Bands usually place a 20-period SMA between two bands set two standard deviations away. The HMA version replaces that middle SMA with Alan Hull's weighted moving average calculation. Some scripts also calculate deviation around the HMA, while others keep a standard deviation of price. Those implementations are not equivalent.

  • HMA(n) = WMA(2 x WMA(price, n/2) - WMA(price, n), sqrt(n)).
  • Upper band = HMA basis + deviation multiplier x standard deviation.
  • Lower band = HMA basis - deviation multiplier x standard deviation.
  • Document how the deviation is calculated before comparing scripts.

Signals worth testing

A close above a rising HMA basis can define trend direction. A close outside an outer band can define expansion, while a close back inside can define re-entry. None of these events is a trade by itself. Add an invalidation rule and a maximum holding period before running a backtest.

  • Continuation: price closes above the upper band while the HMA slope is positive.
  • Pullback: price returns to the HMA basis during a defined uptrend.
  • Re-entry: price closes outside a band, then closes back inside on a later bar.

Why a faster basis can produce worse results

Less visual lag does not prove better trading performance. A responsive HMA can create more basis crosses in noisy markets, and extra trades can raise fee and slippage costs. Compare the same dates, symbols, fees, and exit rules against the standard SMA version.

HMA basis vs standard SMA basis

InputHMA Bollinger BandsStandard Bollinger Bands
Center lineHull Moving AverageSimple Moving Average
ResponseUsually reacts sooner to recent price changesUsually changes more gradually
Main riskMore crosses in noisy conditionsLater response after a sharp turn
Fair testHold all other inputs constantUse as the baseline

HMA Bollinger Bands Pine Script prompt

This prompt keeps the variation explicit and produces rules you can inspect.

Create a Pine Script v6 indicator with a 20-period Hull Moving Average basis. Plot upper and lower bands at 2 standard deviations of close around the HMA. Add inputs for HMA length, deviation length, multiplier, and source. Mark bar-close re-entry signals after price closes outside a band and then back inside. Add alerts, but do not place trades or claim that a signal predicts direction.
Generate the HMA bands

Pineify is an information tool, not investment advice. This page explains a test method and promises no returns. Historical results can fail in live trading.

Common questions