andre_007

Divergences Refurbished

andre_007 已更新   
Just as "a butterfly can flap its wings over a flower in China and cause a hurricane in the Caribbean" (Edward Lorenz), small divergences in markets can signal big trading opportunities.


█Introduction

This is a script forked from LonesomeTheBlue's Divergence for Many Indicators v4.
It is a script that checks for divergence between price and many indicators.

In this version, I added more indicators and also added 40 symbols to check for divergences.
More info on the original script can be found here:


█ Improvements

The following improvements have been implemented over v4:

1. Added parameters to customize indicators.

2. Added new indicators:
- Stoch RSI
- Volume Oscillator
- PVT (Price Volume Trend)
- Ultimate Oscillator
- Fisher Transform
- Z-Score/T-Score

3. Now there is the possibility of using 2 external indicators.

4. New option to show tooltips inside labels.
This allows you to save space on the screen if you choose the option to only show the number of divergences or just the abbreviations.

5. New option to show additional text next to the indicator name.
This allows for grouping of indicators and symbols and better visualization, whether through emojis, for example.

6. Added 40 customizable symbols to check for divergences.

7. Option "show only the first letter" of the indicator replaced by: "show the abbreviation of the indicator".
Reason: the indicator abbreviation is more informative and easier to read.

8. Script converted to PineScript version 5.


█ CONCEPTS

Below I present a brief description of the available indicators.

1. Moving Average Convergence/Divergence (MACD):
Shows the difference between short-term and long-term exponential moving averages.

2. MACD Histogram:
Shows the difference between MACD and its signal line.

3. Relative Strength Index (RSI):
Measures the relative strength of recent price gains to recent price losses of an asset.

4. Stochastic Oscillator (Stoch):
Compares the current price of an asset to its price range over a specified time period.

5. Stoch RSI:
Stochastic of RSI.

6. Commodity Channel Index (CCI):
Measures the relationship between an asset's current price and its moving average.

7. Momentum: Shows the difference between the current price and the price a few periods ago.
Shows the difference between the current price and the price of a certain period in the past.

8. Chaikin Money Flow (CMF):
A variation of A/D that takes into account the daily price variation and weighs trading volume accordingly. Accumulation/Distribution (A/D) identifies buying and selling pressure by tracking the flow of money into and out of an asset based on volume patterns.

9. On-Balance Volume (OBV):
Identify divergences between trading volume and an asset's price.
Sum of trading volume when the price rises and subtracts volume when the price falls.

10. Money Flow Index (MFI):
Measures volume pressure in a range of 0 to 100.
Calculates the ratio of volume when the price goes up and when the price goes down.

11. Volume Oscillator (VO):
Identify divergences between trading volume and an asset's price. Ratio of change of volume, from a fast period in relation to a long period.

12. Price-Volume Trend (PVT):
Identify the strength of an asset's price trend based on its trading volume. Cumulative change in price with volume factor. The PVT calculation is similar to the OBV calculation, but it takes into account the percentage price change multiplied by the current volume, plus the previous PVT value.

13. Ultimate Oscillator (UO):
Combines three different time periods to help identify possible reversal points.

14. Fisher Transform (FT):
Normalize prices into a Gaussian normal distribution.

15. Z-Score/T-Score: Shows the difference between the current price and the price a few periods ago. I is a statistical measurement that indicates how many standard deviations a data point is from the mean of a data set.
When to use t-score instead of z-score? When the sample size is small (length < 30).
Here, the use of z-score or t-score is chosen automatically based on the length parameter.


█ What to look for

The operation is simple. The script checks for divergences between the price and the selected indicators.
Now with the possibility of using multiple symbols, it is possible to check divergences between different assets.

A well-described view on divergences can be found in this cheat sheet:


◈ Examples with SPY ETF versus indicators:

1. Regular bullish divergence with external indicator:

1. Regular bearish divergence with Fisher Transform:

1. Positive hidden divergence with Momentum indicator:

1. Negative hidden divergence with RSI:


◈ Examples with SPY ETF versus other symbols:

1. Regular bearish divergence with European Stoch Market:

2. Regular bearish divergence with DXY inverted:

3. Regular bullish divergence with Taiwan Dollar:

4. Regular bearish divergence with US10Y (10-Year US Treasury Note):

5. Regular bullish divergence with QQQ ETF (Nasdaq 100):

6. Regular bullish divergence with ARKK ETF (ARK Innovation):

7.Positive hidden divergence with RSP ETF (S&P 500 Equal Weight):

8. Negative hidden divergence with EWZ ETF (Brazil):


◈ Examples with BTCUSD versus other symbols:

1. Regular bearish divergence with BTCUSDLONGS from Bitfinex:

2. Regular bearish divergence with BLOK ETF (Amplify Transformational Data Sharing):

3. Negative hidden divergence with NATGAS (Natural Gas):

4. Positive hidden divergence with TOTALDEFI (Total DeFi Market Cap):


█ Conclusion

The symbols available to check divergences were chosen in such a way as to cover the main markets, in the most generic way possible.
You can adjust them according to your needs.

A trader in the American market, for example, could add more ETFs, American stocks, and sectoral indices, such as the XLF (Financial Select Sector SPDR Fund), the XLK (Technology Select Sector SPDR), etc.

On the other hand, a cryptocurrency trader could add more currency pairs and sector indicators, such as BTCUSDSHORTS (Bitfinex), USDT.D (Tether Dominance), etc.

If the chart becomes too cluttered, you can use the option to show only the number of divergences or only the indicator abbreviations.
Or even disable certain indicators and symbols, if they are not of interest to you.

I hope this script is useful.
Don't forget to support LonesomeTheBlue's work too.
版本注释:
v2
New features:

- Added alert for any divergence regardless of type. This aims to save the amount of user interactions, in case he wanted an alert for all types of divergence:

- Added 2 external indicators, now totaling 4.
版本注释:
v3

New features:

1. Added the option to move the label.
The shift is in percentage terms relative to the price edge.
Useful for fine adjustments, aiming not to overlap other indicators.

2. Added option to show support and resistance at points where divergences were found.

3. Some parameters have been reorganized to make them easier to find.

To contribute to my work, I accept cryptocurrency donations.
⚡Bitcoin Lightning Network: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵Litecoin: ltc1q4lssqlf6lnmpe4w7npdl5ws2uamm4v5zxwmf5j
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?