OPEN-SOURCE SCRIPT
The Divergence Toolkit is designed to automatically detect divergences between the price of an underlying asset and any other TradingView built-in or community-built indicator or script. This algorithm provides a comprehensive solution for identifying both regular and hidden divergences, empowering traders with valuable insights into potential trend reversals. 🔲 Methodology Divergences occur when there is a disagreement between the price action of an asset and the corresponding indicator. Let's review the conditions for regular and hidden divergences. Regular divergences indicate a potential reversal in the current trend. Regular Bullish Divergence Regular Bearish Divergence Hidden divergences indicate a potential continuation of the existing trend. Hidden Bullish Divergence Hidden Bearish Divergence In both regular and hidden divergences, the key is to observe the relationship between the price action and the indicator. Divergences can provide valuable insights into potential trend reversals or continuations. The methodology employed in this script involves the detection of divergences through conditional price levels rather than relying on detected pivots. Traditionally, divergences are created by identifying pivots in both the underlying asset and the oscillator. However, this script employs a trailing stop on the oscillator to detect potential swings, providing a real-time approach to identifying divergences, you may find more info about it here (SuperTrend Toolkit). We detect swings or pivots simply by testing for crosses between the indicator and its trailing stop. By testing for conditional price levels, the script achieves similar outcomes without the delays associated with pivot-based methods. 🔲 Setup Guide A simple example on one of my public scripts, Standardized MACD 🔲 Utility We may auto-detect divergences to spot trend reversals & continuations. 🔲 Settings 🔲 Alerts As well as the option to trigger 'any alert' call. The Divergence Toolkit provides traders with a dynamic tool for spotting potential trend reversals and continuations. Its innovative approach to real-time divergence detection enhances the timeliness of identifying market opportunities.
Open-source script
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.