TradingView
PHVNTOM_TRADER
Sep 27, 2022 1:20 PM

MTF Stoch RSI + Realtime Divergences 

Ethereum / TetherUSBinance

Description

Multi-timeframe Stochastic RSI + Realtime Divergences + Alerts + Pivot lookback periods.

This version of the Stochastic RSI adds the following additional features to the stock UO by Tradingview:

- Optional 3 x Multiple-timeframe overbought and oversold signals, indicating where 3 selected timeframes are all overbought (>80) or all oversold (<20) at the same time, with alert option.
- Optional divergence lines drawn directly onto the oscillator in realtime, with alert options.
- Configurable lookback periods to fine tune the divergences drawn in order to suit different trading styles and timeframes, including the ability to enable automatic adjustment of pivot period per chart timeframe.
- Alternate timeframe feature allows you to configure the oscillator to use data from a different timeframe than the chart it is loaded on.
- Indications where the Stoch RSI is crossing down from above the overbought threshold (<80) and crossing above the oversold threshold (>20) levels on a given user selected timeframe, by printing gold dots on the indicator.
- Also includes standard configurable Stoch RSI options, including k length, d length, RSI length, Stochastic length, and source type (close, hl2, etc)

While this version of the Stochastic RSI has the ability to draw divergences in realtime along with related settings and alerts so you can be notified as divergences occur without spending all day watching the charts, the main purpose of this indicator was to provide the triple multiple-timeframe overbought and oversold confluence signals and alerts, in an attempt to add more confluence, weight and reliability to the single timeframe overbought and oversold states, commonly used for trade entry confluence. It's primary purpose is intended for scalping on lower timeframes, typically between 1-15 minutes. The triple timeframe overbought can often indicate near term reversals to the downside, with the triple timeframe oversold often indicating neartime reversals to the upside. The default timeframes for this confluence are set to check the 1 minute, 5 minute, and 15 minute timeframes, ideal for scalping the < 15 minute charts.


The Stochastic RSI

The popular oscillator has been described as follows:

“The Stochastic RSI is an indicator used in technical analysis that ranges between zero and one (or zero and 100 on some charting platforms) and is created by applying the Stochastic oscillator formula to a set of relative strength index (RSI) values rather than to standard price data. Using RSI values within the Stochastic formula gives traders an idea of whether the current RSI value is overbought or oversold. The Stochastic RSI oscillator was developed to take advantage of both momentum indicators in order to create a more sensitive indicator that is attuned to a specific security's historical performance rather than a generalized analysis of price change.”


How do traders use overbought and oversold levels in their trading?

The oversold level, that is when the Stochastic RSI is above the 80 level is typically interpreted as being 'overbought', and below the 20 level is typically considered 'oversold'. Traders will often use the Stochastic RSI at an overbought level as a confluence for entry into a short position, and the Stochastic RSI at an oversold level as a confluence for an entry into a long position. These levels do not mean that price will necessarily reverse at those levels in a reliable way, however. This is why this version of the Stoch RSI employs the triple timeframe overbought and oversold confluence, in an attempt to add a more confluence and reliability to this usage of the Stoch RSI.


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.


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, and also when the triple timeframe overbought and oversold confluences occur.


Configurable pivot lookback values.

You can adjust the default pivot lookback values 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. By default, this indicator has enabled the automatic adjustment of the pivot periods for 4 configurable timeframes, in a bid to optimise the divergences drawn when the indicator is loaded onto any of the 4 timeframes. These timeframes and the auto adjusted pivot periods on each of them can also be reconfigured within the settings menu.


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.


Disclaimer: This script includes code from the stock UO by Tradingview as well as the Divergence for Many Indicators v4 by LonesomeTheBlue.

Release Notes

- Corrected the overbought threshold level.
- Replace the option to highlight the range bands with an option to highlight the background colour to make it much clearer.
- added an option to select a different colour for the oversold triple timeframe confluence, to distinguish it from the overbough colour.

Release Notes

-Added full indicator name, symbol info and timeframe to chart to comply with house rules.
-Presented on a naked chart to comply with house rules
-Trimmed whitespace at end of file

Release Notes

- Updated screenshot to include both the triple MTF overbought & oversold background colour highlight feature, as well as the realtime divergence lines for illustrative purposes.
- Removed whitespace

Release Notes

- Updated the screenshot to show Japanese candles instead of Heikin Ashi candles to comply with Tradingview rules

Release Notes

- Added faully configurability over the triple timeframe overbought and oversold thresholds, suited to a range of low timeframe charts but with defaults settings pulling in data from higher timeframes for their confluences.
- Added a entire secondary set of triple timeframe confluences, able to be enabled or disabled.
- Added options to customise the style of the oscillator lines when they reach overbought and oversold, including conditional colouring and linewidth.
- Added ability to select the colour for the dots plotted when the oscillator crossing down below 80, or crosses up over 20
- Corrected the OB/OS threshold
- Added separate alert for the new secondary MTF OB/OS confluence

Release Notes

- Updated OB/OS crossing dot to be brighter by default

Release Notes

- Removed setting label that isn't needed
- Set divergence lines (show only last) to enabled by default

Release Notes

- Corrected the grouping and labels of the Stoch RSI MTF settings menu sections.

Release Notes

- Corrected the tooltip information under the background colouring option in the settings menu.

Release Notes

- Added an option to hide the range bands and oscillator itself, leaving visible only the MTF overbought and oversold background colours where enabled.

Release Notes

- Added a feature to allow the background colour to include the overbought and oversold periods of the current timeframe, alongside the MTF confluences.
- Updated the chart image to illustrate the use case and appearance of the 'hide oscillator' / use background colours to signal overbought and oversold feature.
- Renamed and reorganised settings options to make them clearer.
- Disabled the secondary set of MTFoverbought and oversold confluences by default.

Release Notes

- Updated the chart image to include the divergence lines for illustration purposes.

Release Notes

- Updated the MTF#2 default timeframes to 15, 30, 120 minutes.
- Removed the need for the oscillator line to be overbought in order for the MTF background colour to show overbought, same for oversold.
- Removed need to enable setting 'Highlight MTF OB/OS on oscillator' in order to then enable the MTF confluences on the background colour.
- Altered the default colour of the MTF#2 confluences to distinguish them from the MTF#1 confluences.

Release Notes

- Reorganised settings menu, improved grouping of settings, bought divergence settings higher up in the settings menu, renamed labels to make them clearer.
- Minor refactor of code / group names

Release Notes

- Altered the osc to use bargaps so the line is smoother when selecting a higher timeframe than the chart it's on.

Release Notes

- Renamed the 'Hide oscillator' related settings and improved the clarity of their configuration description within the tooltip

Release Notes

- Added a bar color option to show the MTF confluences. Disabled by default.
- Renamed variables, removed unused variables.

Release Notes

- Removed the unused source input option from pivot period settings.

Release Notes

- Updated MTF overbought and oversold alerts to only alert once if following bars remain overbought / oversold.
- Updated divergence alerts to allows for alerting any type of divergence in a single alert.
- Updated alerts to allow for the alerting of overbought and oversold signals on MTF #1 separately.

Release Notes

- Reorgnised the settings menu
- Renamed settings text labels for consistency
- Removed the auto-adjust pivot period based on current chart timeframe.

Release Notes

- Added a feature to the settings menu to optionally present the 3x oscillator values of the MTF #1 timeframes as a table.

Release Notes

- Added an optional table that presents the oscillator values for each of the 3 MTF #1 timeframes, with colour coded values when they reach their overbought and oversold thresholds.

Release Notes

- Updated the MTF values table with additional features to optionally show MTF #1 values only, MTF #2 values only, or the values of both sets of MTF confluences.

Release Notes

- Fixed error in MTF table colour coding based on user defined threshold levels

Release Notes

- Fixed issue whereby too many labels were appearing in the Y axis when label values were enabled.
- Refactored the k and d line MTF highlight colour code.
- Added MTF #1 timeframes into data window for debugging.

Release Notes

- Added an option to select dark or light theme on MTF table, which changes the label text between white/black
- Minor adjustments to label text in settings to make settings dialog thinner.
Comments
Food_Plus
Thank you for sharing.. nice work.. what should I change to put the Rsi indicator instead of the Stoch Rsi?
PHVNTOM_TRADER
@Food_Plus, apologies, I just saw this comment.

I'll try and boost your reputation on TV so I can send you a dm, which will enable the feature for you, too. I can't dm you currently. That way I can share the script which I already have for the MTF RSI. It requires quite a few changes. Alternatively, you might consider a free 1 month trial of Tradingview Pro+, which can be cancelled before the first month ends free of charge if you decide against it. This might enable the messaging feature for you during that period, I'm not sure.

I know I'm allowed to share scripts via dm on Tradingview, but I'm not sure about posting links to scripts in this comment section.

Failing that, I may publish the MTF RSI publicly to Tradingview if I think it is of value to others, too.
Food_Plus
@tvenn, ok thanks
Crypto_Popat
hi, great concept, is there any way we can use labels instead of lines, it give clean look.
Thank you
PHVNTOM_TRADER
@Crypto_Popat, Hey glad you find it useful.

I might take a look if I get time, though personally I think lines are not only cleaner, more simple and minimal than multiple text labels, but also give the key info a text label wouldn't imo, such as where the divergences is drawn from and to exactly, what is the angle etc, which without it, doesn't really communicate the particular quality of the divergence, only where one ends. You can in the meantime go into settings and reduce the line width from 2 down to 1, and also adjust the line opacity to make it less prominent also.
Flyfreedom
hey Tvenn, the changes of style colors always revert back to the default setting, can you take a look?
PHVNTOM_TRADER
@Flyfreedom, When I change the colours on the current version on Tradingview, and then select 'save as default' at the bottom of the settings dialog in the dropdown that reads 'Defaults', then remove the indicator from my chart, then re-add it, the custom colours I selected remain showing for me. They're not reverting back to the factory defaults when I try this.
TraderZ_4
Great script - thanks for sharing! One question: is there a way to capture the highest price between the two lows that make a bullish divergence?
PHVNTOM_TRADER
@TraderZ_4, I guess, although not sure what you want to do with it, or how to present it. I'm guessing it's not something many ppl would make use of.
it is technically possible to use a built-in PineScript feature ta.highest() to find the highest price in a range.
More