All indicators

RSI5_50 with Divergence

May 19, 2020

Static chart image
SignalsOscillatorsDivergencesPivot Based (Retrospective)

The RSI5_50 with Divergence indicator is a dual-period Relative Strength Index strategy designed to identify high-probability entries by filtering short-term momentum divergences with long-term trend bias.

Usage

The script utilizes two RSI components: a short-term RSI (default 5 periods) and a long-term RSI (default 50 periods).

  • Buy Conditions: A long entry is triggered when the long-term RSI is above the 50 level and a bullish divergence (regular or hidden) is detected on the short-term RSI.
  • Pyramiding: If a long position is already active, the strategy can add to the existing position when the short-term RSI crosses above the 20 level.
  • Take Profit: The strategy manages exits through a tiered take-profit system based on the long-term RSI reaching specific overbought thresholds (60, 65, 70, and 75).
  • Exit Conditions: Positions are closed if the long-term RSI crosses below the 30 level or if the optional 8% stop loss is triggered.

Details

This tool implements both regular and hidden divergences based on pivot points. Regular bullish divergence occurs when the price makes a lower low but the RSI makes a higher low, suggesting a potential reversal. Hidden bullish divergence occurs when the price makes a higher low but the RSI makes a lower low, suggesting trend continuation. By requiring the long-term RSI to be above 50, the script ensures that these bullish signals are only traded during established uptrends.

Settings

General Settings

  • RSI Period: The lookback period for the short-term RSI used for divergence detection.
  • Long RSI Period: The lookback period for the long-term trend filter.
  • RSI Source: The price source used for calculations (default is Close).
  • Pivot Lookback Right/Left: Determines the number of bars required to confirm a pivot high or low.
  • Take Profit at RSI Level: The primary RSI threshold to trigger a 75% partial exit.
  • Stop Loss%: A toggle to enable a hard 8% stop loss rule from the average entry price.

Divergence Settings

  • Max/Min of Lookback Range: Sets the range (in bars) within which the script looks for previous pivots to form a divergence.
  • Plot Bull/Hidden Bull: Toggles the visibility of regular and hidden bullish divergence labels.
  • Plot Bear/Hidden Bear: Toggles the visibility of regular and hidden bearish divergence labels.

FAQ

How do I access RSI5_50 with Divergence?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Can I use this for shorting?

While the script visualizes bearish divergences, the built-in strategy logic is currently optimized for long-only entries using the long-term RSI trend filter.

What does the background color represent?

The background fill indicates the state of the long-term trend: a green background appears when the long-term RSI is above 50, while a red background appears when it is below 50.

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.