OPEN-SOURCE SCRIPT

Relative Strength Index (RSI) + Realtime Divergences

Actualizado
Relative Strength Index (RSI) + Realtime Divergences

This version of the RSI indicator includes the following features:

- Optional divergence lines drawn directly onto the oscillator in realtime.
- Configurable alerts to notify you when divergences occur.
- Configurable lookback periods to fine tune the divergences drawn in order to suit different trading styles and timeframes.
- Background colouring option to indicate when the RSI oscillator has crossed above or below its centerline.
- Alternate timeframe feature allows you to configure the oscillator to use data from a different timeframe than the chart it is loaded on.
- Fadeout oscillator feature will fade out all but the most recent history, leaving your chart free of visual noise.
- Flip oscillator feature can be used with the Tradingview 'Flip chart' feature (Alt+i) in order to flip both the chart and the oscillator, too. This feature is to help traders manually spot divergences that may have a strong natural bias in one direction.
- Optional centerline and range bands.
- Various optional moving average types, bollinger bands etc.


This indicator adds additional features onto the standard RSI whose core calculations remain unchanged. Namely, the configurable option to automatically, quickly and clearly draw divergence lines onto the oscillator for you as they occur in realtime. It also has the addition of unique alerts, so you can be notified when divergences occur without spending all day watching the charts. Furthermore, this version of the RSI comes with configurable lookback periods, which can be configured in order to adjust the sensitivity of the divergences, in order to suit shorter or higher timeframe trading approaches.


What is the Relative Strength Index ( RSI )?

Investopedia describes the Relative Strength Index as follows:

“The relative strength index (RSI) is a momentum indicator used in technical analysis. RSI measures the speed and magnitude of a security's recent price changes to evaluate overvalued or undervalued conditions in the price of that security. The RSI is displayed as an oscillator (a line graph) on a scale of zero to 100. The indicator was developed by J. Welles Wilder Jr. and introduced in his seminal 1978 book, New Concepts in Technical Trading Systems.

The RSI can do more than point to overbought and oversold securities. It can also indicate securities that may be primed for a trend reversal or corrective pullback in price. It can signal when to buy and sell. Traditionally, an RSI reading of 70 or above indicates an overbought situation. A reading of 30 or below indicates an oversold condition.”

The RSI is also commonly used to spot divergences.
You can read more about the RSI and its calculations here


What are divergences?

Divergence is when the price of an asset is moving in the opposite direction of a technical indicator, such as an oscillator, or is moving contrary to other data. Divergence warns that the current price trend may be weakening, and in some cases may lead to the price changing direction.

There are 4 main types of divergence, which are split into 2 categories;
regular divergences and hidden divergences. Regular divergences indicate possible trend reversals, and hidden divergences indicate possible trend continuation.

Regular bullish divergence: An indication of a potential trend reversal, from the current downtrend, to an uptrend.
Regular bearish divergence: An indication of a potential trend reversal, from the current uptrend, to a downtrend.
Hidden bullish divergence: An indication of a potential uptrend continuation.
Hidden bearish divergence: An indication of a potential downtrend continuation.


How do traders use divergences in their trading?

A divergence is considered a leading indicator in technical analysis , meaning it has the ability to indicate a potential price move in the short term future.

Hidden bullish and hidden bearish divergences, which indicate a potential continuation of the current trend are sometimes considered a good place for traders to begin, since trend continuation occurs more frequently than reversals, or trend changes.

When trading regular bullish divergences and regular bearish divergences, which are indications of a trend reversal, the probability of it doing so may increase when these occur at a strong support or resistance level . A common mistake new traders make is to get into a regular divergence trade too early, assuming it will immediately reverse, but these can continue to form for some time before the trend eventually changes, by using forms of support or resistance as an added confluence, such as when price reaches a moving average, the success rate when trading these patterns may increase.

Typically, traders will manually draw lines across the swing highs and swing lows of both the price chart and the oscillator to see whether they appear to present a divergence, this indicator will draw them for you, quickly and clearly, and can notify you when they occur.


Setting alerts.

With this indicator you can set alerts to notify you when any/all of the above types of divergences occur, on any chart timeframe you choose.


Configurable pivot periods.

You can adjust the default pivot periods to suit your prefered trading style and timeframe. If you like to trade a shorter time frame, lowering the default lookback values will make the divergences drawn more sensitive to short term price action.



Disclaimer: This script includes code from the stock RSI by Tradingview as well as the Divergence for Many Indicators v4 by LonesomeTheBlue.
Notas de prensa
- Set the option 'Show only last divergence' to enabled by default.
Notas de prensa
- Updated alerts so they only trigger once per divergence instance, and not if the following bar reprints the same divergence.
- Added alert that will alert any type of alert in a single alert.
Notas de prensa
- Added a feature "Enabled Heikin Ashi mode for non HA charts" so you can present it as it would on a HA chart, without switching to an actual HA chart, for the purpose of backtesting Heikin Ashi strategies using Tradingviews Replay feature, which is disabled for HA charts.
Notas de prensa
- Rearranged settings menu
Notas de prensa
- Increased the default pivot period from 5 to 12, inline with all my other indicators pivot period values.
Notas de prensa
- Added 2x sets of optional multi-timeframe overbought and oversold signals with various presentation options.
- Added optional table to present the RSI levels on the selected individual timeframes.
Notas de prensa
- Added a feature to optionally highlight divergences within overbought or oversold levels as defined by the configurable current timeframe ob/os thresholds within settings menu.
- Reorganised the settings menu.
- Updated default colours for MTF #2
Notas de prensa
- Fixed issue where if option to show labels for indicators is enabled, this indicator would show multiple duplicate value labels in the Y axis. It will now show only one.
Divergencedivergencesindexmulti-timeframerelativeRelative Strength Index (RSI)strength

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?


También en:

Exención de responsabilidad