OPEN-SOURCE SCRIPT

RF+ Divergence Scalping System

Cập nhật
RF+ Divergence Scalping System + Custom Signals + Alerts.

This chart overlay indicator has been developed for the low timeframe divergence scalper.

Built upon the realtime divergence drawing code from the Divergence for Many indicator originally authored by Lonsometheblue, this chart overlay indicator bundles several additional unique features and modifications to serve as an all-in-one divergence scalping system. The current key features at the time of publishing are listed below (features are optional and can be enabled or disabled):

- Fully configurable realtime divergence drawing and alerting feature that can draw divergences directly on the chart using data sourced from up to 11 oscillators selected by the user, which have been included specifically for their ability to detect divergences, including oscillators not presently included in the original Divergence for Many indicator, such as the Ultimate Oscillator and TSI.
- Optional on chart table showing a summary of key statuses of various indicators, and nearby divergences.
- 2 x Range Filters with custom settings used for low timeframe trend detection.
- 3 x configurable multi-timeframe Stochastic RSI overbought and oversold signals with presentation options.
- On-chart pivot points drawn automatically.
- Automatically adjusted pivot period for up to 4 configurable time frames to fine tune divergences drawn for optimal divergence detection.
- Real-price line for use with Heikin Ashi candles, with styling options.
- Real-price close dots for use with Heikin Ashi candles, with styling options.
- A selection of custom signals that can be printed on-chart and alerted.
- Sessions indicator for the London, New York, Tokyo and Sydney trading sessions, including daylight savings toggle, and unique ‘invert background color’ option, which colours the entire chart - except the trading session you have selected, leaving your chart clear of distracting background color.
- Up to 4 fully configurable moving averages.
- Additional configurable settings for numerous built in indicators, allowing you to alter the lengths and source types, including the UO, TSI, MFI, TSV, 2 x Range Filters.
- Configurable RSI Trend detection signal filter used in a number of the signals, which filters buy signals where the RSI is over the RSI moving average, and only prints sell signals where RSI is under the moving average.
- Customisable on-chart watermark, with inputs for a custom title, subtitle, and also an optional symbol | timeframe | date feature.

The Oscillators able to be selected for use in drawing divergences at the time of publishing are as follows:
- Ultimate Oscillator (UO)
- True Strength Indicator (TSI)
- Money Flow Index (MFI)
- Cumulative Delta Volume (CDV)
- Time Segmented Volume (TSV)
- Commodity Channel Index (CCI)
- Awesome Oscillator
- Relative Strength Index (RSI)
- Stochastic
- On Balance Volume (OBV)
- MACD Histogram


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, also when the triple timeframe Stochastic RSI overbought and oversold confluences occur, as well as when custom signals are printed.


Configurable pivot period values.

You can adjust the default pivot period 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 time frames, in a bid to optimize the divergences drawn when the indicator is loaded onto any of the 4 time frames selected. These time frames and their associated pivot periods can be fully reconfigured within the settings menu. By default, these have been further optimized for the low timeframe scalper trading on the 1-15 minute time frames.


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.


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

The oversold level 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, or crossing down from an overbought level as a confluence for entry into a short position, and the Stochastic RSI at, or crossing up from 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.

This indicator is intended for use in conjunction with related panel indicators including the TSI+ (True Strength Indicator + Realtime Divergences), UO+ (Ultimate Oscillator + Realtime Divergences), and optionally the STRSI+ (MTF Stochastic RSI + Realtime Divergences) and MFI+ (Money Flow Index + Realtime Divergences) available via this authors’ Tradingview profile, under the scripts section. The realtime divergence drawing code will not identify all divergences, so it is suggested that you also have panel indicators to observe. Each panel indicator also offers additional means of entry confirmation into divergence trades, for example, the Stochastic can indicate when it is crossing down from overbought or up from oversold, the TSi can indicate when the 2 TSI bands cross over one another upward or downward, and the UO and MFI can indicate an entry confluence when they are nearing, or crossing their centerlines, for more confidence in your divergence trade entries.

Additional information on the settings for this indicator can be found via the tooltips within the settings menu itself. Further information on feature updates, and usage tips & tricks will be added to the comments section below in due course.


Disclaimer: This indicator uses code adapted from the Divergence for Many v4 indicator authored by Lonesometheblue, and several stock indicators authored by Tradingview. With many thanks.
Phát hành các Ghi chú
- Added a signal and related alert to show where there is a recent MTF Stoch RSI oversold, and a recent bullish divergence, and is followed by a ni wich Heikin Ashi bullish candle indicating the start of a reversal to the upside for entry signals long, and vice versa for shorts.
- Removed excessive alerts for price crossing EMA to free up outputs for better alerts.
- Refactored two separate bullisg divergence and bearish divergence alert types into one to free up outputs for different alerts and notifying certain criteria simpler. Granular alerts for both bullish and bearish instances of the same criteria not needed.
- Increased the lookback for recent bars with divergences from 5 to 6. Will look to refactor this into a function in future so I can pass a different lookback value on a per signal basis suited to that given signal.
Phát hành các Ghi chú
-Reduced the length of one of the signal descriptions so that the settings menu is slimmer for the benefit of viewing on mobile.
Phát hành các Ghi chú
- Turned off the dashboard by default.
- Turned off the real price close dots by default.
- Turned off the 144 ema by default.
- Combined a bullish and bearish alert for the same criteria into one alert for both bullish and bearish variants.
- Increased the transparency of the on-chart lines that indicate the MTF Stoch overbought/oversold times.
Phát hành các Ghi chú
- Renamed multiple alerts
Phát hành các Ghi chú
- Removed code using HA specific functions for identifying no wick candles, still has the same result.
- Updated the default watermark text to include indicator name
- Updated screenshot to include full indicator name, full symbol detail and timeframe. Also removed the FRVP drawing tool from the screenshot to comply with house rules.
Phát hành các Ghi chú
- Added an optioin to only show the multi-timeframe ribbon indicator (and hide where only the current timeframe Stoch RSI is overbought annd oversold) to keep chart clearer. Enabled by default.
- Renamed the the plot titles for the MTF ribbon highlights.
Phát hành các Ghi chú
- Added a setting to enable signals that can be passed to the Ultimate Strategy Template by Daveatt, for backtesting testing signals. Disabled by default. Additional signals may be added in future.
- Altered the default colour of the real price line for Heikin Ashi to orange, to help distinguish it from the typical colour of horizontal support and resistance lines.
Phát hành các Ghi chú
- Added the MTF Stoch RSI status to the dashboard table, so you can now see the confluences happening at low timeframes, including when the MTF Stoch RSI ribbon and background colouring is disabled, and including in realtime on a higher timeframe chart where the confluence has disappeared by the time that higher timeframe chart period closes, and therefore the signal would not be printed.
- Corrected the conditional colouring of the Divergence signal shown in the dashboard table.
Phát hành các Ghi chú
- Updated the colour of the real price close dots to be semi-transparent orange that do not appear so messy on the chart
- Update the chart in the image to present the overlay indicator on Japanese candles instead of Heikin Ashi, to comply with TV rules on indicators that provide buy/sell signals in relation to Heikin Ashi candles, since Heikin Ashi do not reflect real market prices and therefore produce unrealistic results.
Phát hành các Ghi chú
- Added Doji candle higlighting option. Off by default
- Changed the default colour of the real price close dots to be demi-transparent orange instead of blue for subtlety
- Reduced the number of bars checked when checking for recent divergences or recent MTF Stoch OB/OS for the sake of related signals and alerts.
Phát hành các Ghi chú
- Updated chart to show Japanese candles instead of Heikin Ashi candles to comply with Tradingview rules.
Phát hành các Ghi chú
- Actually updated chart image to show Japanese candles
Phát hành các Ghi chú
- Added a second MTF Stoch RSI triple timeframe confluence settings section
- Refactored Alerts
- Reorganised the settings menu
- Fixed a bug where part of the dashboard was showing signals on chart when the dashboard setting was set to disabled
- Disabled some features and signals by default for people who want to use this indicator in different ways then myself
Phát hành các Ghi chú
- Removed a few of the custom confluence signals which were not sufficiently useful to a broader usage, freeing up more outputs for more useful signals and alerts.
Phát hành các Ghi chú
- Corrected the MFI source to use hlc3 instead of close by default.
- Disabled the Range Filters by default.
- Disabled the secondary MTF Stoch RSI confluence background colours by default.
Phát hành các Ghi chú
- Added an 'Enable sessions' checkbox to allow users to toggle their sessions settings on and off in one click without having to reselect their various options options each time to do so. Enabled (on) by default.
Phát hành các Ghi chú
- Adjusted to show Range Filters by default
- Adjusted to show 144 ema by default
- Adjusted the secondary MTF Stoch RSI confluence colours
- Adjusted to show onlu UO, TSI and MFI by default
- Adjusted to only show MTF Stoch RSI ribbon, but no the background stripes by default
Phát hành các Ghi chú
- Updated the MTF#2 default timeframes to 15, 30, 120 minutes.
Phát hành các Ghi chú
- Removed the need to have a Doji or Nowick HA candle before alerting to a confluence of MTF Stoch RSI OB/OS + Divergence.
- Added alert option to notify users of where there is a confluence of a MTF Stoch RSI overbought at the same time as a bearish divergence, and MTF Stoch RSI oversold at the same time as a bullish divergence, for potential reversal trades.
Phát hành các Ghi chú
- Altered the default for the MTF #1 Stoch OB/OS signal, now enabled by default
- Background colour for the MTF #1 Stoch OB/OS also enabled by default.
- MTF #2 Stoch RSI OB/OS ribbon (but not background colour) now enabled by default
- Remove the text from the MTF #1 Stoch OB/OS + Divergence signal, so the label is now smaller
- Reordered the emas, so 144 ema is now #1, which is the one that has the alert option linked to it.
Phát hành các Ghi chú
- Added option to show moving average levels for a single moving average length and type for up to 3 different selected timeframes between 1-15 minutes, presented to the right of the current chart as horizontal lines. Default options set to 144ema, with 3min, 5min and 15min timeframes selected, suitable for the low timeframe scalper. Feature disabled by default.
- Refactored moving average function.
Phát hành các Ghi chú
- Added Range Filter line color and width options.
Phát hành các Ghi chú
- Reorganised the settings menu options.
- Disabled all custom signals by default.
Phát hành các Ghi chú
- Adjusted the default real price close dots to use the custom colur input instead of a hard coded color.
- Adjusted the default real price close dot colour to blue instead of orange to be in keeping with the overall default colour theme.
Phát hành các Ghi chú
- Improved label description for including current timeframe Stoch RSI overbought and oversold signals in ribbon.
- Corrected the current timeframe ribbon signals to print once, in MTF #1 colours, not twice.
Phát hành các Ghi chú
- Updated chart image
Phát hành các Ghi chú
- Renamed setting "Include current timeframe OB/OS in MTF #1 ribbon" and momved it into the MTF #1 settings section
Phát hành các Ghi chú
- Refactored the Stoch RSI current timeframe signal code
- Reorganised the settings menu, pulling the MTF Stoch RSI confluences above the moving averages and sessions settings.
Phát hành các Ghi chú
- Moved the current timeframe ribbon and threshold options above the MTF #1 and MTF #2 sections in the settings menu.
- Relabeled the MTF #1 and MTF #2 ribbon setting labels for greater clarity.
Phát hành các Ghi chú
- Corrected tooltip text
Phát hành các Ghi chú
- Added separate colour and linewidth styling options for each Range filter, so each of the two Range Filters can be styled independently.
Phát hành các Ghi chú
- Added a set of triple-timeframe CCI confluences like the Stoch RSI set, to signal where all timeframes meet their configurable overbought and oversold thresholds at the same time.
- Added a 'combi' signal, to highlight where the MTF #1 Stoch RSI AND the MTF CCI triple-timeframe overbought and oversold signals occur together at the same time.
- Updated the MTF OB/OS + Divergence signal to include the CCI as well as the Stoch RSI, to fulfil the MTF part of the criteria.
- Set the default enabled oscillators for use in drawing divergences to include: UO, TSI, MFI, RSI and CCI.
- Minor altering of styling to the Range Filters, making the longer length RF more prominent, muting the colour of the shorter length RF.
- Updated the chart image
Phát hành các Ghi chú
- Updated the CCI source type and length to use the configurable values defined within the MTF CCI section. Defaults now set to length 20 and source type hlc3 (inline with my other CCI indicator defaults).
Phát hành các Ghi chú
- Set the MTF CCI 15m timeframe thresholds to -150 and 150.
Phát hành các Ghi chú
- Removed the secondary MTF Stoch RSI set of triple timeframe confluences.
- Included the current timeframe Stoch RSI and CCI overbought and oversold signals in ribbon by default.
- Added barcoloring option alongside the background and ribbon coloring options for both MTF Stoch RSI and MTF CCI confluence signals.
- Enabled 2 of the custom signals by default.
Phát hành các Ghi chú
- Reduced the default opacity of the combi MTF CCI + Stoch RSI signal background color.
Phát hành các Ghi chú
- Fixed the MTF overbought/oversold + divergence custom signal, to include the MTF CCI as well as the MTF Stoch RSI.
- Updated the custom signal title and tooltip text.
- Renamed variables.
Phát hành các Ghi chú
- Set the RF pullback custom signals to disabled by default.
Phát hành các Ghi chú
- Updated alerts to only alert once per instance of a divergence / MTF signal, not if the following bars reprint the same divergence / MTF signal.
- Updated the "MTF OB/OS on RF+" alert to notify on either the MTF CCI overbought and oversold periods, or the existing MTF Stoch RSI overbought and oversold periods, now an all-in-one MTF OB/OS alert.
Phát hành các Ghi chú
- Removed duplicate MTF OB/OS alert.
Phát hành các Ghi chú
- Enabled by default the MTF 144 EMA.
Phát hành các Ghi chú
- Added an option for an auto anchored VWAP, defaulted to 2 Day, disabled by default.
- Refactored the MTF ribbons to reduce outputs.
Phát hành các Ghi chú
- Added a feature that optionally draws horizontal lines from the start point of regular divergences that can be used as an entry level confirmation where price reverses beyond that point. Disabled by deefault.
- Disabled the pullback custom indications by default.
- Disabled all but 4 of the oscillators used to draw divergences by default. UO, TSI, RSI and MFI still enabled by default.
Phát hành các Ghi chú
- Renamed oscillators & reg divergence confirmation line length label.
- Reduced default opacity of moving averages and range filters.
Phát hành các Ghi chú
- Completely reorganised the settings menu.
- Placing global toggle switches for all settings at top of menu dialog for easy access.
- Removed the Auto-adjust pivot period for different timeframes feature which was of limited use and to improve performance.
- Renamed settings labels for consistency.
Phát hành các Ghi chú
- Minor reorganisation of settings menu.
- Settings menu text formating for consistency.
Phát hành các Ghi chú
- Fixed a bug related to proper colouring of the ribbon for MTF signals, that weren't brighter for some MTF overbought/oversold periods
Phát hành các Ghi chú
- Replaced the dashboard with the 3x selected timeframes of CCI and Stoch RSI values, with colour coded labels when overbought and oversold.
Phát hành các Ghi chú
- Removed the current date from the watermark symbol info
Phát hành các Ghi chú
- Fixed error in colour coding of MTF table labels.
Phát hành các Ghi chú
- Color coded the values in the MTF table when they reach their respective overbought and oversold levels.
Phát hành các Ghi chú
- Adjusted the color coding of the MTF table values
Phát hành các Ghi chú
- Linked the colour coded values in the MTF table to the custom overbought and oversold colours for the CCI and Stoch RSI so that they still match if the colours are changed.
Phát hành các Ghi chú
- Added global control at top of settings menu for the moving average(s).
- Added a mobile / desktop resizing feature to the MTF table/dashboard.
- Hid the decimal place of the CCI and Stoch RSI values in the MTF table values for easier reading.
- Reordered some settings.
Phát hành các Ghi chú
- Removed a few oscillators from the list used for detecting divergences.
- Hid the labels produced by parts of the indicator to keep the Y axis uncluttered for traders who have label values enabled in Tradingview.
Phát hành các Ghi chú
- Disabled the MTF background colours by default. The default settings now only signal these MTF signals in the ribbon at top and bottom of the chart. Background colours can be re-enabled within settings.
Phát hành các Ghi chú
- Updated the default colour of the 144ema and the MTF moving average levels to orange in order to distinguish them apart from the blue Range Filters.
Phát hành các Ghi chú
- Adjusted default colours.
Phát hành các Ghi chú
- Added HULL type moving average to both the 3x moving averages and also the 3x MTF moving averages.
Phát hành các Ghi chú
- Added alert options for Range Filter 1 change. Two alerts in the form of 'Range Filter 1 Buy in RF+' and 'Range Filter 1 Sell in RF+'.
- Minor adjustment to Range Filter colours, and removed unused Range Filter code for the upper and lower bands.
Phát hành các Ghi chú
- Reduced the MTF MA timeframe label text
Phát hành các Ghi chú
- Added option to change the color of the regular divergence confirm line, under the styles section, under the inputs tab of settings menu.
- Added another oscillator to be used for divergence detection, a hybrid of the UO and MFI - the UFO. Enabled by default.
Phát hành các Ghi chú
- Removed the Doji highlighting and the sessions features in effort to reduce liklihood of timeout error
Divergencefiltermulti-timeframemultitimeframeoverlayrangerealtimeRelative Strength Index (RSI)scalpingStochastic Oscillator

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm