Variable Length Moving Average
May 2, 2020

The Variable Length Moving Average indicator provides a dynamic smoothing mechanism that automatically adjusts its calculation period based on price volatility to track market trends with minimal lag.
Usage
The Usage section describes how the script can be used to identify market trends and potential reversal points. This indicator functions as a responsive trend-following tool that changes color based on the relationship between price and the moving average line.
- Trend Identification: When the moving average line and price bars are colored green, it indicates a bullish trend where price remains above the average. Conversely, red coloring indicates a bearish trend where price remains below the average.
- Dynamic Responsiveness: Unlike static moving averages, the VLMA adjusts its sensitivity. During periods of high volatility or significant price breakouts, the indicator reduces its effective length to "hug" the price action more closely, providing faster exit or entry signals. During sideways or low-volatility markets, the length increases to filter out market noise.
- Signal Crossovers: Traders can look for color changes as potential entry or exit signals. A shift from red to green suggests a bullish crossover, while a shift from green to red suggests a bearish crossunder.
Details
The Variable Length Moving Average was originally developed by George R. Arrington Ph.D. and published in "Stocks & Commodities." The core concept involves adjusting the smoothing constant of the average based on where the current price sits relative to standard deviation bands.
The algorithm calculates a mean and four specific bands based on standard deviations (±0.25 and ±1.75). The calculation period (length) is modified bar-by-bar:
- If the price is within the inner bands (suggesting low volatility or consolidation), the length increases, making the average more stable.
- If the price moves outside the outer bands (suggesting high volatility or a strong trend), the length decreases, making the average more responsive to the new price level.
- The resulting length is then used within an exponential-style smoothing formula to produce the final VLMA line.
Settings
- Source: Determines the price data used for the calculation (e.g., Close, Open, High, Low).
- Resolution: Allows the user to calculate the indicator based on a different timeframe than the current chart.
- Allow Repainting?: Determines if the multi-timeframe data should be processed to avoid repainting or to show real-time values.
- Allow Bar Color Change?: Enables or disables the changing of candle colors to match the trend detected by the VLMA.
- MinLength: The lower bound for the dynamic length calculation, preventing the average from becoming overly sensitive.
- MaxLength: The upper bound for the dynamic length calculation, defining the maximum smoothing applied during stable periods.
FAQ
How does this differ from a standard Variable Moving Average (VMA)? While both are adaptive, this version specifically uses George R. Arrington’s logic involving standard deviation thresholds to iterate the length, rather than using a volatility index like Chande’s VMA.
Can this indicator be used on any timeframe? Yes, the VLMA is designed to be timeframe-agnostic and includes a "Resolution" setting to overlay higher timeframe trends onto lower timeframe charts.
How do I access the Variable Length Moving Average? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
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.

