HMA w/ SSE-Dynamic EWMA Volatility Bands

Oct 10, 2022

Static chart image
Channels
Dashboard
Moving Averages
Volatility

The HMA w/ SSE-Dynamic EWMA Volatility Bands indicator provides a dynamic volatility-based envelope centered around a Hull Moving Average (HMA) by optimizing the decay factor (lambda) for Exponentially Weighted Moving Average (EWMA) calculations.

Usage

The tool can be used to identify trend direction and potential price overextensions. The central HMA identifies the primary trend direction, changing color from green (bullish) to red (bearish). The surrounding bands expand and contract based on dynamic volatility, serving as potential support or resistance areas.

Key usage scenarios include:

  • Trend Filtering: Use the color of the HMA to stay on the correct side of the market trend.
  • Volatility Breakouts: Monitor price interactions with the upper and lower bands to identify high-momentum moves or mean reversion opportunities.
  • Risk Assessment: Observe the annualized and daily volatility statistics in the dashboard to gauge current market risk.

Details

This script implements an advanced approach to volatility estimation. Instead of using a fixed lambda (such as the standard 0.94 used by RiskMetrics), it derives a dynamic lambda (λ) by minimizing the sum of squared errors (SSE) against the long-run variance (the one-year mean of squared log-returns).

The calculation process includes:

  1. Log Returns: Computing log(close / close[1]).
  2. Lambda Optimization: Iteratively finding the lambda value that best fits the historical data within a rolling window.
  3. EWMA Calculation: Applying the optimized lambda to derive daily volatility.
  4. Band Construction: Creating bands by multiplying the daily volatility by the source price and a user-defined multiplier, then centering them on an HMA.
  5. Annualization: Multiplying daily volatility by the square root of the trading days per year to provide standardized annualized volatility metrics.

Settings

General

  • Source: The price source used for the HMA and volatility calculations.
  • Lookback Period for Mean of Squared Log-returns: The window used to calculate the target variance for lambda optimization.
  • Lookback Period for Mean of Lambda: The period over which the calculated lambda is averaged for the dashboard display.
  • Days per Year: The number of trading days used to annualize volatility (e.g., 252 for stocks, 365 for crypto).
  • HMA Period: The lookback period for the central Hull Moving Average.
  • Use fast Log2 approximation?: When enabled, uses a faster mathematical approximation for log calculations to improve performance.
  • Number of bars to calculate: Limits the historical lookback for the optimization algorithm to maintain script performance.
  • Bands Volatility Multiplier: Adjusts the width of the volatility bands.

FAQ

How do I interpret the Mean of Lambda in the dashboard?

A higher lambda (closer to 1.0) indicates that the volatility estimate responds slowly to new price changes, emphasizing older data. A lower lambda means the indicator reacts more quickly to recent price shocks.

Why does the indicator only work on the daily timeframe?

The SSE-Dynamic logic is optimized for daily log-returns to avoid complexities involved in annualizing intraday volatility metrics and to ensure accuracy in the parameter estimation.

How can I access this indicator?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

ninjatraderNinjaTrader
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

metatrader4MetaTrader 4/5
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

thinkorswimThinkorswim
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.