LWMA: Linear Weighted Moving Average
Jun 21, 2020

The LWMA: Linear Weighted Moving Average indicator provides a customizable trend-following tool that applies linear weight distribution to price data to reduce lag and improve responsiveness to recent market movements.
Usage
The Usage section describes how the script can be used to identify market trends and potential reversal points. Because the LWMA places a higher mathematical priority on recent price action, it reacts faster than a Simple Moving Average (SMA) or Exponential Moving Average (EMA).
- Trend Identification: Users can observe the slope and color of the LWMA to determine the current trend direction. A rising, green line indicates bullish momentum, while a falling, red line indicates bearish momentum.
- Crossovers: Price crossing above the LWMA can be interpreted as a bullish signal, while crossing below may indicate a bearish shift.
- Support and Resistance: The moving average line often acts as a dynamic level where price may find support during uptrends or resistance during downtrends.
- Filtering: To account for potential false signals in low-volatility environments, it is recommended to use this tool alongside volatility oscillators or other volume-based filters.
Details
The script implements a specific linear weighting formula to ensure that the most recent data points have the greatest impact on the average. The calculation follows this logic:
LWMA = ((Pn * W1) + (Pn-1 * W2) + (Pn-2 * W3)...) / ∑W
Where:
- Pn represents the price for the current period.
- W represents the assigned weight, which descends linearly based on the lookback period and weight settings.
By adjusting the "LWMA Weight" parameter, users can control the steepness of the weighting gradient, allowing for a more aggressive or smoother reaction to price changes compared to standard WMA implementations.
Settings
- LWMA Source: Determines the price data used for the calculation (e.g., Close, Open, High, Low).
- LWMA Lookback Period: Sets the number of bars used to calculate the average.
- LWMA Weight: Controls the linear weighting factor applied to the calculation, affecting how heavily recent data is prioritized.
- Directional color change?: A toggle to enable or disable the visual color shift of the line based on whether the average is rising or falling.
FAQ
How does LWMA differ from a standard WMA? The LWMA uses a specific linear decay for weights that ensures a consistent reduction in priority for older data points, often resulting in less lag than standard weighted moving averages found in default library sets.
Can I use this for automated alerts? Yes, the script includes optimized alerts for trend direction changes (Rising/Falling) and price crossovers (Price crossing over/under the LWMA).
How do I get access to the LWMA: Linear 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.

