OPEN-SOURCE SCRIPT

Divergences Refurbished

Diupdate
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:
Divergence for Many Indicators v4



█ 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:
Divergence Cheat Sheet



◈ Examples with SPY ETF versus indicators:

1. Regular bullish divergence with external indicator:
cuplikan

1. Regular bearish divergence with Fisher Transform:
cuplikan

1. Positive hidden divergence with Momentum indicator:
cuplikan

1. Negative hidden divergence with RSI:
cuplikan


◈ Examples with SPY ETF versus other symbols:

1. Regular bearish divergence with European Stoch Market:
cuplikan

2. Regular bearish divergence with DXY inverted:
cuplikan

3. Regular bullish divergence with Taiwan Dollar:
cuplikan

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

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

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

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

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


◈ Examples with BTCUSD versus other symbols:

1. Regular bearish divergence with BTCUSDLONGS from Bitfinex:
cuplikan

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

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

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


█ 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.
Catatan Rilis
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:
cuplikan

- Added 2 external indicators, now totaling 4.
Catatan Rilis
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.
cuplikan

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.
Chart patternsPivot points and levelsSupport and Resistance

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?


To contribute to my work:
⚡Bitcoin Lightning: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵PayPal: paypal.com/donate/?hosted_button_id=D9KRKY5HMSL9S
Juga di:

Pernyataan Penyangkalan