PROTECTED SOURCE SCRIPT

[Rygel] Dual time frame Bollinger Bands with signals and alerts

アップデート済
This indicator displays two Bollinger Bands coming from two different time frames, chart's current one and a higher one.
It analyzes these two Bollinger Bands data and combines them with RSI, MFI and MACD divergences and SuperTrend to identify areas of opportunity where price is the most likely to be at a local top or bottom.

It uses probabilistic data, the Bollinger Bands, to identify convergence areas where the price is statistically overbought or oversold simultaneously at two different time frames, it then looks for signs of a trend exhaustion, using RSI, MFI and MACD divergences, and finally it looks for an early confirmation of a trend reversal, using SuperTrend data with aggressive settings.

This indicator does not produce buy and sell signals. You won't get a buy for every sell or a sell for every buy. In a bearish trend, you may get multiple consecutive bullish signals and in a bullish trend multiple bearish signals.
It is meant to help you to identify and to alert you about areas of opportunity where you could, for instance, consider taking some profits or opening a trade.
It is meant to support your investment or trading decisions, not to induce them.


SIGNALS

This indicator generated multiple types of signals. Diamonds are better than squares. Colored ones are better than grey ones.

  • Green square: a bullish signal confirmed by a regular divergence
  • Red square: a bearish signal confirmed by a regular divergence
  • Blue square: a bullish signal confirmed by a hidden divergence (disabled by default as these signals are less reliable)
  • Orange square: a bearish signal confirmed by a hidden divergence (disabled by default as these signals are less reliable)
  • Diamonds: same as the square signals but the signal is forming a divergence with a previous one. Diamond signals are always stronger (i.e. more reliable) than square signals.
  • Grey signals: same as the previous ones but for weaker signals. These signals appear when price in the current time frame is overbought or oversold but only close to be at the higher timeframe. (disabled by default as these signals are less reliable)


When a weak signal follows a strong one and creates a MACD divergence with it, it will be considered as a strong signal and displayed as a colored signal, even when weak signals are disabled.

When a strong signal follows a weak one, forming a MACD divergence, it will be shown as a diamond signal, even when weak signals are disabled.

Most reliable signals are green and red diamonds.


SETTINGS

Bollinger Bands

  • Source: the source used to calculate the Bollinger Bands ("close" by default)
  • Length: the moving-average length of the Bollinger Bands (20 by default)


You will most likely have no need to change these settings. If you're wondering what they actually do, you should most likely not touch them.

  • Main channel standard deviation: the standard deviation used to calculate the classical Bollinger Bands channel. (2.0 by default)
  • Outer bands standard deviation: additional channels outside the main one, using a larger standard deviation. (3.0 by default)


Theoretically, with a 1.0 standard deviation, around 68% of the price action should be contained within the Bollinger Bands.
With a 2.0 standard deviation, around 95%.
With a 3.0 standard deviation, around 99.7%.
With a 4.0 standard deviation, around 99.99%.

But as security prices returns have no actual statistical distribution, these probabilities don't strictly apply to Bollinger Bands. According to Wikipedia, studies have found that with a 2.0 standard deviation, only about 88% (85–90%) of the price data remain with the Bollinger Bands, instead of the theoretical 95%.

The higher you set the values, the less signals you'll get.
You should most likely keep the main channel standard deviation between 2 and 3 and add between +0.5 and +1 for the outer bands.
Most commonly used value for Bollinger Bands is 2.0.

Current time frame

  • Show current time frame Bollinger Bands: these are the Bollinger Bands you're used to. (enabled by default)


スナップショット

  • Show current time frame outer bands: add two additional bands outside the main channel using a larger standard deviation. (enabled by default)


スナップショット

Higher time frame

  • Show higher time frame Bollinger Bands: display secondary Bollinger Bands from a higher time frame. Time frames are configured in the below "Time frames" section. (enabled by default)


スナップショット

  • Show higher time frame outer bands: add two additional bands outside the main channel using a larger standard deviation (enabled by default)


スナップショット

Overbought and oversold

  • Show oversold and overbought background: add a background to the higher time Bollinger Bands whose color depends on the dual time frame Bollinger Bands oversold / overbought status. (enabled by default)


Asset is considered overbought/oversold when its price is outside of the Bollinger Bands' main channel.
Asset is considered strongly overbought/oversold when its price is outside of the Bollinger Bands' outer bands.

  • Dark red: both time frame are overbought (outside the main channel)
  • Red: one time frame is strongly overbought (outside the outer bands) and the other one is overbought (outside the main channel)
  • Bright red: both time frame are strongly overbought (outside the outer bands)
  • Dark green: both time frame are oversold (outside the main channel)
  • Green: one time frame is strongly oversold (outside the outer bands) and the other one is oversold (outside the main channel)
  • Bright green: both time frame are strongly oversold (outside the outer bands)


スナップショット

Signals

  • Show signals: display signals when an area of opportunity is detected. Read the introduction and the Signals section for more information. (enabled by default)
  • Show weak signals: display signals although at the higher time frame price is not yet overbought or oversold but close to be (disabled by default)


Divergences

  • Use MACD for divergences(enabled by default)
  • Use MFI for divergences(enabled by default)
  • Use RSI for divergences(enabled by default)


At least one source of divergences must be enabled for signals to work.

  • Enable hidden divergences: signals don't use hidden divergences by default as they generate more false positives than regular divergences. You can enable them to get more signals, it can be especially useful at high time frames (like weekly, monthly, etc.) where signals are rarer. (disabled by default)


  • Show divergences: draw MACD, MFI and RSI divergences on the chart. (disabled by default)


  • Green: regular bullish divergence
  • Red: regular bearish divergence
  • Blue: hidden bullish divergence
  • Orange: hidden bearish divergence


スナップショット

Confirmation

  • Confirmation speed: a faster confirmation speed will generate more false positive signals, a slower one will produce delayed but more reliable signals.


  • Fastest: don't wait for a SuperTrend confirmation, only wait for a divergence confirmation. Lot of false positives.
    スナップショット
  • Fast: wait for a fast SuperTrend confirmation (SuperTrend factor = 1). [default value]
    スナップショット
  • Medium: wait for a slower but more reliable SuperTrend confirmation (SuperTrend factor = 2). Fewer false positives but more lagging signals.
    スナップショット
  • Slow: wait for an even slower but very reliable SuperTrend confirmation (SuperTrend factor = 3). Very few false positives but very late signals.
    スナップショット


Time frames

You can define the higher time frames you wish to use here.

Default values try to adhere to a x6 to x8 ratio, x4 to x12 at maximum.
Some pairs are more significant than others, like 4 hour + daily, daily + weekly and weekly + monthly.

  • 1 second: 10 seconds
  • 5 seconds: 30 seconds
  • 10 seconds: 1 minute
  • 15 seconds: 2 minutes
  • 30 seconds: 3 minutes
  • 1 minute: 10 minutes
  • 2 minutes: 15 minutes
  • 3-4 minutes: 30 minutes
  • 5-9 minutes: 45 minutes
  • 10-11 minutes: 1 hour
  • 12-14 minutes: 1 hour
  • 15-29 minutes: 2 hours
  • 30-44 minutes: 4 hours
  • 45-59 minutes: 6 hours
  • 1 hour: 8 hours
  • 2 hours: 12 hours
  • 3 hours: 1 day
  • 4-5 hours: 1 day
  • 6-7 hours: 2 days
  • 8-11 hours: 3 days
  • 12-23 hours: 4 days
  • 1 day: 1 week
  • 2 days: 2 weeks
  • 3 days: 3 weeks
  • 4 days: 1 month
  • 5 days: 1 month
  • 6 days: 1 month
  • 1 week: 1 month
  • 2 weeks: 2 months
  • 3 weeks: 3 months
  • 1 month: 6 months
  • 2 months: 9 months
  • 3 months: 12 months
  • 4 months: 15 months
  • 5 months: 21 months
  • 6 months: 24 months


Time frames use the TradingView units:

  • s = seconds
  • h = hours
  • D = days
  • W = weeks
  • M = months
  • no unit = minutes


Time frame strings follow these rules:

  • They are composed of the multiplier and the time frame unit, e.g., “1S”, “30” (30 minutes), “1D” (one day), “3M” (three months).
  • The unit is represented by a single letter, with no letter used for minutes: “S” for seconds, “D” for days, “W” for weeks and “M” for months.
  • When no multiplier is used, 1 is assumed: “S” is equivalent to “1S”, “D” to “1D, etc. If only “1” is used, it is interpreted as “1min”, since no unit letter identifier is used for minutes.
  • There is no “hour” unit; “1H” is not valid. The correct format for one hour is “60” (remember no unit letter is specified for minutes).
  • The valid multipliers vary for each time frame unit:
    - For seconds, only the discrete 1, 5, 10, 15 and 30 multipliers are valid.
    - For minutes, 1 to 1440.
    - For days, 1 to 365.
    - For weeks, 1 to 52.
    - For months, 1 to 12.


Styles

You can configure the appearance of the Bollinger Bands, the overbought / oversold background, the divergences and the signals here.

Advanced - MACD

Settings used for the MACD divergences. You most likely won't need to change these values, especially if you need them to be explained.

Advanced - MFI

Settings used for the MACD divergences. You most likely won't need to change these values, especially if you need them to be explained.

Advanced - RSI

Settings used for the MACD divergences. You most likely won't need to change these values, especially if you need them to be explained.

Advanced - SuperTrend

Settings used for the MACD divergences. You most likely won't need to change these values, especially if you need them to be explained.


ALERTS

  • Any signal: a bullish or bearish signal has been detected.
  • Bullish signal: a bullish signal has been detected.
  • Bullish signal with divergence: a bullish signal forming a divergence with a previous bullish signal has been detected.
  • Bearish signal: a bearish signal has been detected.
  • Bearish signal with divergence: a bearish signal forming a divergence with a previous bearish signal has been detected.


Overbought/oversold = asset price is outside of the Bollinger Bands' main channel.
Strongly overbought/oversold = asset price is outside of the Bollinger Bands' outer bands.

  • Current time frame - Entering overbought: asset is now overbought at the current time frame.
  • Current time frame - Exiting overbought: asset is not overbought anymore at the current time frame.
  • Current time frame - Entering strongly overbought: asset is now strongly overbought at the current time frame.
  • Current time frame - Exiting strongly overbought: asset is not strongly overbought anymore at the current time frame.
  • Current time frame - Entering oversold: asset is now oversold at the current time frame.
  • Current time frame - Exiting oversold: asset is not oversold anymore at the current time frame.
  • Current time frame - Entering strongly oversold: asset is now strongly oversold at the current time frame.
  • Current time frame - Exiting strongly oversold: asset is not strongly oversold anymore at the current time frame.
  • Higher time frame - Entering overbought: asset is now overbought at the higher time frame.
  • Higher time frame - Exiting overbought: asset is not overbought anymore at the higher time frame.
  • Higher time frame - Entering strongly overbought: asset is now strongly overbought at the higher time frame.
  • Higher time frame - Exiting strongly overbought: asset is not strongly overbought anymore at the higher time frame.
  • Higher time frame - Entering oversold: asset is now oversold at the higher time frame.
  • Higher time frame - Exiting oversold: asset is not oversold anymore at the higher time frame.
  • Higher time frame - Entering strongly oversold: asset is now strongly oversold at the higher time frame.
  • Higher time frame - Exiting strongly oversold: asset is not strongly oversold anymore at the higher time frame.
  • Dual time frame - Entering overbought: asset is now overbought at current and higher time frames.
  • Dual time frame - Exiting overbought: asset is not overbought anymore at current and higher time frames.
  • Dual time frame - Entering oversold: asset is now oversold at current and higher time frames.
  • Dual time frame - Exiting oversold: asset is not oversold anymore at current and higher time frames.
  • Dual time frame - Entering strongly overbought: asset is now strongly overbought at current and higher time frames.
  • Dual time frame - Exiting strongly overbought: asset is not strongly overbought anymore at current and higher time frames.
  • Dual time frame - Entering strongly oversold: asset is now strongly oversold at current and higher time frames.
  • Dual time frame - Exiting strongly oversold: asset is not strongly oversold anymore at current and higher time frames.



ABOUT THE HIGHER TIME FRAME BOLLINGER BANDS

Using a classical higher time frame Bollinger Bands would produce lagging data. For instance, if we are using a weekly BB at the daily time frame, we'll have to wait up to 7 days for the weekly bar to close to get the actual final weekly BB values. Instead, this indicator generates real time higher time frame Bollinger Bands by multiplying the moving average length of the Bollinger Bands by the higher time frame / current time frame ratio. For instance, a weekly BB in the daily time frame will use a x7 ratio (i.e. a 20 * 7 = 140 days MA BB).

It produces slightly different but very similar bands that are as meaningful and can be used in real time at lower time frames.

Alternatives would have been to wait up to seven days for signals to be finalized, which would have render them meaningless. Or to use previous week data, which would have made the signal inaccurrate.

To sum up, weekly Bollinger Bands use a 20 weeks moving average updated one time a week. In the daily time frame, this indicator also use a 20 weeks (140 days) moving average but updated daily instead of weekly.

A comparison between a traditional higher time frame Bollinger Bands vs the ones used by this indicator:

スナップショット

Blue and orange lines are the actual weekly BBs, grey ones are the daily updated ones.


ABOUT THE DIVERGENCES

This indicator uses the same divergences algorithm as my other indicators:

- RSI with divergences
- MACD with divergences
- Trend Reversal Indicator

You'll find more information about this algorithm on my RSI page.
リリースノート
Volume can now be used to generate signals. This feature is enabled by default.

When volume is decreasing prior to a signal, making it more likely for the current trend to be exhausted, the signal gets brighter and a dot is added to it.

スナップショット

  • A new setting has been added to the "Signals" category: "Enable decreasing volume signals". (Enabled by default.)
  • A new category "Advanced - Volume" has been added at the end of the settings to fine tune the decreasing volume sensitivity. (By default the volume must decrease by 10% over 15 bars.)
  • You can configure the volume signal colors and disable the dot under "Styles - Signals".
  • New alerts have been added to target decreasing volume signals:
    - Bullish signal with decreasing volume
    - Bullish signal with divergence and decreasing volume
    - Bearish signal with decreasing volume
    - Bearish signal with divergence and decreasing volume
リリースノート
Fixed an issue where volume dots where still visible when decreasing volume signals were disabled.
alertBands and ChannelsBBBollinger Bands (BB)divergencesdualtimeframemultitimeframessignals

保護スクリプト

このスクリプトは保護スクリプトとして公開されており、個人利用として利用することは可能です。

チャートでこのスクリプトを利用したいですか?


他のメディア:

免責事項