Exponentially Weighted Moving Average Oscillator
Mar 4, 2024

The Exponentially Weighted Moving Average Oscillator indicator provides a normalized momentum tool that transforms traditional EWMA calculations into a bounded oscillator to assist in trend identification and strength assessment. This script utilizes a custom calculation method to allow for more nuanced observation weighting than standard built-in functions, offering a clearer view of market cycles and trend reversals.
Usage
The Usage section describes how the script can be used, particularly in identifying trend direction and momentum changes. This tool is best utilized on medium to long-term timeframes to filter out market noise.
- Trend Identification: The oscillator moves around a zero midline. When the histogram is above zero, the trend is considered bullish; when below zero, it is considered bearish.
- Momentum Strength: The colors of the histogram columns adjust based on the Rate of Change (RoC). A bright color indicates the oscillator is moving in the direction of the trend (strengthening), while a faded color indicates the oscillator is moving against the current trend (weakening), providing a visual cue to potential trend exhaustion or pullbacks.
- Normalization: By bounding the EWMA between a fixed range, traders can more easily compare the relative strength of price movements across different securities or timeframes regardless of the absolute price level.
- Bar Coloring: Users can enable the "Color Bars off Trend?" setting to sync the price chart candle colors with the oscillator's trend logic, allowing for a cohesive visual analysis of the current market state.
Details
The Exponentially Weighted Moving Average (EWMA) is a statistical measure where older observations are given exponentially lower weights. Unlike standard implementations, this script uses a specific iterative loop to calculate the sum of weighted observations, which allows for greater customization in how alpha (the decay factor) is applied.
The indicator follows these calculation steps:
- EWMA Calculation: It calculates the weighted average based on the user-defined period and source.
- Normalization: The resulting EWMA is normalized using a lookback period to determine the highest and lowest values in that window.
- Oscillator Conversion: The normalized value is centered at zero, resulting in a range that oscillates between -0.5 and 0.5.
- Directional Logic: It tracks the current value against the previous value to determine if the momentum is increasing (positive RoC) or decreasing (negative RoC).
Settings
EWMA Calculation
- Calculation Period: Defines the number of bars used to determine the EWMA and its alpha decay factor. Higher values result in a smoother, slower-reacting oscillator.
- Source: The price data point used for the calculation (e.g., Close, HL2, OHLC4).
Normalization
- Normalization lookback: The number of bars used to determine the highest and lowest points for the normalization process. This affects how sensitive the oscillator is to recent price extremes.
Visuals
- Color Bars off Trend?: A toggle that, when enabled, changes the color of the price chart candles to match the bullish or bearish state of the oscillator.
FAQ
How do I interpret the faded colors on the histogram?
Faded colors represent a divergence between the trend direction and the immediate momentum. For example, a faded green bar indicates that while the trend is still bullish (above zero), the momentum is currently slowing down (lower than the previous bar).
Can this indicator be used for scalping?
While it can be used on lower timeframes, the EWMA calculation and normalization process are generally more effective on medium to high timeframes (like the 1H, 4H, or 1D) to provide a more reliable quantitative measure of trend strength.
How do I access the Exponentially Weighted Moving Average Oscillator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Unlock Unlimited Access to the LuxAlgo Library
Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.
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.

