Gain/Loss Moving Average

Jul 4, 2018

Static chart image
Signals
Divergences
Moving Averages

The Gain/Loss Moving Average tool tracks momentum by calculating the average percentage change in price to help traders identify trend exhaustion and reliable divergences without the constraints of range-bound oscillators.

Usage

The Usage section describes how the script can be used to analyze market momentum and trend shifts. Traders typically use this indicator to identify periods where gains or losses are accelerating or decelerating.

  • Trend Direction: When the indicator is above the zero line, the average gains outweigh the average losses, suggesting a bullish trend. Conversely, values below zero indicate a bearish trend.
  • Divergence Trading: Because the indicator is not range-bound (unlike the RSI), it can provide clearer divergence signals. If price makes a higher high but the Gain/Loss Moving Average makes a lower high, it suggests weakening bullish momentum.
  • Typical Price Analysis: Users can change the "Source" input to hlc3 (Typical Price) to capture a broader range of price action data within each candle, which can be more effective for identifying divergences than using the "Close" price alone.
  • RSI Synchronization: To sync this indicator with a standard RSI, you can use the formula (2 * RSI Length) - 1. For example, setting the length to 27 will approximate the behavior of a 14-period RSI while maintaining the benefits of an unbounded scale.

Details

The Gain/Loss Moving Average calculates the change in price relative to the average of the current and previous price points. This approach ensures mathematical symmetry in the calculation. By dividing the price change by the average price and multiplying by 100, the script produces a percentage-based momentum value.

Unlike the Relative Strength Index (RSI), which compresses values into a 0-100 scale, this indicator remains unbounded. This lack of compression prevents the indicator from "flattening" during extreme market moves, allowing for more distinct peaks and troughs that are often more reliable for technical analysis. The script offers two types of moving averages for smoothing this data: Simple Moving Average (SMA) and Smoothed Moving Average (RMA).

Settings

  • Source: Determines the price data used for the calculation (e.g., Close, Open, High, Low, HLC3).
  • Moving Average Type: Allows the user to choose between "Simple" (SMA) for a standard average or "Smoothed" (RMA) for a calculation similar to the internal smoothing of the RSI.
  • Length: The lookback period used for the moving average calculation. A higher length results in a smoother line with less noise, while a shorter length is more responsive to price changes.

FAQ

How does this indicator differ from the RSI?

While both measure the strength of gains versus losses, the Gain/Loss Moving Average is not range-bound. This prevents the indicator from hitting a ceiling or floor, which can make divergences easier to spot during strong trends.

Why use Smoothed instead of Simple moving averages?

The "Smoothed" option uses a Rolling Moving Average (RMA), which is the same smoothing method used in the standard RSI. This provides a more stable, less reactive output compared to the Simple Moving Average.

How can I access the Gain/Loss Moving Average?

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
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

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.