MARS - Moving Average Relative Strength
Mar 15, 2023

The Moving Average Relative Strength (MARS) indicator measures the relative performance of a symbol against a benchmark index by comparing their respective distances from a moving average. This tool allows traders to identify periods of outperformance and underperformance through a normalized visual interface, providing clarity on whether a stock is truly stronger than the broader market.
Usage
The Usage section describes how the script can be used to identify market trends and relative strength. Traders typically use MARS to find stocks that hold up better than the index during market corrections or lead the index during rallies.
- Identifying Outperformance: When the histogram or line is above the zero mark (positive values), the stock is outperforming the index based on its distance from the selected moving average.
- Identifying Underperformance: When the histogram or line is below the zero mark (negative values), the stock is underperforming the index.
- Trend Context: The background color (when enabled) provides immediate context for the benchmark index. A blue background indicates the index is above its moving average (bullish context), while a pink background indicates it is below (bearish context).
- Signal Refinement: The smoothing line can be used to filter noise, where crossovers between the MARS value and the smoothing line indicate shifts in relative momentum.
Details
The MARS script calculates relative strength by measuring the percentage distance of a price from its moving average: ((Price - MA) / MA) * 100. This calculation is performed for both the local symbol and a user-defined benchmark index. The final MARS value is the difference between these two percentages.
The indicator categorizes performance into six specific market conditions:
- Relative Outperformance: Both are bearish, but the stock is less bearish.
- Gross Outperformance: Both are bullish, but the stock is more bullish.
- Absolute Outperformance: The index is bearish, but the stock is bullish.
- Relative Underperformance: Both are bullish, but the stock is less bullish.
- Gross Underperformance: Both are bearish, but the stock is more bearish.
- Absolute Underperformance: The index is bullish, but the stock is bearish.
This logic refines the original concept of "Percentage Relative Strength" by dman103, which used daily percentage changes instead of moving average distances.
Settings
Moving Average for Relative Strength
- Moving Average Type: Selects the calculation method (SMA, EMA, or WMA) for the core relative strength logic.
- Moving Average Length: Sets the lookback period (default is 50) for the moving averages of both the stock and index.
- Plot Style: Determines if the data is displayed as a Line, Histogram, or Columns.
Smoothing
- Show Smoothing Line: Toggles the visibility of the signal smoothing line.
- Method: Selects the MA type for the smoothing line.
- Length: Sets the lookback period for the smoothing line.
Index for Relative Strength
- Index to compare To: Provides a dropdown of common indices.
- Compare to different index?: Enables the use of a custom symbol.
- Other Index: Allows the user to input any ticker symbol as a benchmark.
Customisation
- Paint Bar?: Colors the price bars on the chart to match the MARS performance categories.
- Background Color?: Shades the chart background based on the index's position relative to its MA.
- Easy Colors?: Simplifies the histogram into two colors (Green/Red) instead of the detailed six-color mode.
- Dark Mode for Table: Adjusts the UI table theme.
- Show Zero Line: Toggles the baseline for outperformance vs. underperformance.
FAQ
How do I interpret the zero line in the MARS indicator? The zero line represents parity with the index. Values above zero indicate the stock is performing better than the benchmark relative to the moving average, while values below zero indicate it is lagging.
Can I use this indicator for any asset class? Yes, while the defaults are set for indices, you can use the "Other Index" setting to compare any two assets, such as comparing one cryptocurrency to Bitcoin or a specific stock to its sector ETF.
How do I get access to the MARS indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.