Optimal Weighted Moving Average
May 14, 2020

The Optimal Weighted Moving Average indicator provides a dynamic trend-following tool that adjusts its weighting mechanism based on the correlation between price and the average itself to provide enhanced signal clarity.
Usage
The Usage section describes how the script can be used to identify market trends and potential entry or exit points.
- Trend Identification: Traders can use the color-coded output to determine market direction. A green line indicates a bullish trend where the price is trading above the average, while a red line indicates a bearish trend where the price is trading below the average.
- Crossovers: Buy signals occur when the price crosses above the OWMA (turning it green), and sell signals occur when the price crosses below the OWMA (turning it red).
- Multi-Timeframe Analysis: By using the Resolution setting, traders can overlay a higher-timeframe OWMA on a lower-timeframe chart to filter out market noise and trade in the direction of the primary trend.
- Sensitivity Adjustments: The Length input directly impacts the indicator's responsiveness. A shorter length is suitable for scalp trading and quick reactions, whereas a longer length helps in identifying long-term structural shifts in the market.
Details
The Optimal Weighted Moving Average was originally introduced by Thomas Hutchinson and Peter G. Zhang, Ph.D. Unlike a standard Weighted Moving Average (WMA) that uses linear weighting, the OWMA utilizes the correlation between the input source and the previous value of the indicator to determine the weights for each data point in the lookback period.
Specifically, the script calculates weights using the formula weight = (length - i) ^ correlation. This adaptive approach allows the moving average to shift its sensitivity based on how well the price is currently correlating with its own average. The script also includes a security function to handle multi-timeframe data and features built-in alert conditions for bullish and bearish changes.
Settings
- Source: Determines the price data used for the indicator calculation (e.g., Close, Open, High, Low).
- Resolution: Allows the indicator to be calculated based on a specific timeframe regardless of the current chart timeframe.
- Allow Repainting?: A toggle to enable or disable repainting behavior for higher timeframe data.
- Allow Bar Color Change?: When enabled, the price bars on the chart will change color to match the current trend signal.
- Length: Sets the lookback period used for both the moving average calculation and the correlation coefficient.
FAQ
How does the OWMA differ from a standard Moving Average? The OWMA is adaptive; it uses the correlation between price and the average as an exponent for its weights, making it more responsive to price action compared to a static simple or exponential moving average.
Can this indicator be used on any asset? Yes, the Optimal Weighted Moving Average is a versatile technical analysis tool that can be applied to equities, forex, crypto, and commodities on any timeframe.
How do I get access to the Optimal Weighted 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.

