All indicators

RSI of MACD Strategy [Long only]

Feb 3, 2021

Static chart image
SignalsOscillatorsMoney ManagementMoving Averages

The RSI of MACD Strategy [Long only] indicator is a quantitative tool designed to identify long entry and exit points by applying the Relative Strength Index (RSI) to the MACD line rather than price. This approach aims to capture momentum shifts within broader trends, using a combination of oscillator levels and moving averages to filter trade signals.

Usage

The strategy is designed for long-side trading and generates signals based on the following logic:

  • Entry Signals: A long position is initiated when the RSI of MACD crosses above the 30 or 35 levels, provided the current price is trading above the Slow EMA. This ensures entries occur when momentum is recovering while the asset is in a broader uptrend.
  • Re-entry: If a position is already active and the entry conditions (RSI crossover + price above EMA) are met again, the strategy allows for pyramiding or re-entry, highlighted visually on the chart by purple-colored bars.
  • Partial Exit: If enabled in the settings, the strategy will close 1/3 of the active position when the RSI of MACD crosses below the 80 level, allowing for profit-taking during overbought conditions.
  • Full Exit: All remaining positions are closed when the RSI of MACD crosses below the 15 level.
  • Position Sizing: The strategy calculates the number of units to purchase based on a user-defined risk percentage of equity and a theoretical stop-loss distance.

Details

The core concept involves smoothing out MACD fluctuations by passing the MACD line through an RSI calculation. This transforms the trend-following MACD into a bounded oscillator (0-100), making it easier to identify oversold and overbought momentum states. The inclusion of an EMA filter helps mitigate "fake-outs" by ensuring the strategy only buys when the price shows structural strength.

The strategy was originally developed for use on higher timeframes, such as the hourly (1H) chart, and has been tested on major ETFs like SPY and QQQ.

Settings

  • Fast Length: The short-term period for the internal MACD calculation.
  • Slow Length: The long-term period for the internal MACD calculation and the Slow EMA filter.
  • Signal Length: The smoothing period for the MACD signal line.
  • RSI of MACD Length: The lookback period used to calculate the RSI of the MACD line.
  • Risk % of capital: The percentage of total equity to risk per trade.
  • Stop Loss: A percentage value used to calculate the position size based on the defined risk.
  • Take Profit: A toggle to enable or disable the partial profit-taking logic at the 80 RSI level.

FAQ

How do I use the RSI of MACD for entries?

Entries are triggered when the RSI of the MACD line crosses above the 30 or 35 oversold thresholds while the price remains above the slow EMA.

What is the purpose of the purple bars?

Purple bars indicate that the entry conditions have been met while a position is already open, suggesting a potential area for adding to the position or confirming the current trend.

How can I access this script?

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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.