OPEN-SOURCE SCRIPT
Diupdate Multi Divergence WALLDEM

The Multi Divergence Indicator is designed to identify price-oscillator divergences across eight common technical oscillators (RSI, MACD, Stochastic, CCI, Momentum, Williams %R, Awesome Oscillator, and OBV), helping traders spot potential reversals or continuations. The original version effectively draws lines and labels for detected divergences but lacks outputs compatible with TradingView's Pine Screener, leading to the error: "The indicator misses plots or alert conditions, have access restrictions, or another issue." This stems from Pine Screener's requirements for at least one plot() or alertcondition() to enable filtering and scanning across symbols.
To resolve this, the fixed version incorporates several enhancements while maintaining the core logic of pivot detection using ta.pivotlow() and ta.pivothigh() with user-defined lookback periods (default: 5 left/right). Divergences are now separated into regular and hidden types for both bullish and bearish cases, aligning more closely with advanced divergence screeners like the provided example from Trendoscope. This separation uses distinct colors (green/lime for bullish regular/hidden, red/orange for bearish) and tooltips listing contributing oscillators.
Detailed Changes and Rationale
The updates focus on compatibility, usability, and granularity:
Overlay Setting: Changed to overlay=false to treat it as a non-overlay indicator suitable for screeners (similar to the example). Drawings (lines/labels) use force_overlay=true to ensure they appear on the main chart pane.
Divergence Separation: Instead of a single bull_count or bear_count, we now calculate:
Regular bullish: Price makes lower low, but oscillator makes higher low.
Hidden bullish: Price makes higher low, but oscillator makes lower low.
Regular bearish: Price makes higher high, but oscillator makes lower high.
Hidden bearish: Price makes lower high, but oscillator makes higher high.
This is checked per oscillator if enabled via inputs, incrementing separate counters and building dedicated tooltips.
Alert Conditions: Added alertcondition() calls when a divergence type's count > 0. This creates selectable alert conditions in TradingView's alert dialog and satisfies screener requirements. Messages include the tooltip for context (e.g., which oscillators contributed).
Plots for Screening: Four new plot() statements output the counts (0 if no detection) with display = display.data_window. These appear in the data window and enable screener filters like "value > 0" or "value >= 3" (for strong signals from multiple oscillators). Plots are hidden from the chart to avoid clutter.
No Impact on Performance: Calculations remain efficient, only triggering on confirmed pivots (delayed by lbR bars for accuracy). The max distance (maxDist) prevents outdated pivot comparisons.
Oscillator-Specific Logic
Each oscillator's divergence check uses its respective value (e.g., MACD histogram for MACD, smoothed %D for Stochastic). Users can toggle calculations via boolean inputs, reducing computation if not needed. Here's a table summarizing the oscillators and their roles:
To resolve this, the fixed version incorporates several enhancements while maintaining the core logic of pivot detection using ta.pivotlow() and ta.pivothigh() with user-defined lookback periods (default: 5 left/right). Divergences are now separated into regular and hidden types for both bullish and bearish cases, aligning more closely with advanced divergence screeners like the provided example from Trendoscope. This separation uses distinct colors (green/lime for bullish regular/hidden, red/orange for bearish) and tooltips listing contributing oscillators.
Detailed Changes and Rationale
The updates focus on compatibility, usability, and granularity:
Overlay Setting: Changed to overlay=false to treat it as a non-overlay indicator suitable for screeners (similar to the example). Drawings (lines/labels) use force_overlay=true to ensure they appear on the main chart pane.
Divergence Separation: Instead of a single bull_count or bear_count, we now calculate:
Regular bullish: Price makes lower low, but oscillator makes higher low.
Hidden bullish: Price makes higher low, but oscillator makes lower low.
Regular bearish: Price makes higher high, but oscillator makes lower high.
Hidden bearish: Price makes lower high, but oscillator makes higher high.
This is checked per oscillator if enabled via inputs, incrementing separate counters and building dedicated tooltips.
Alert Conditions: Added alertcondition() calls when a divergence type's count > 0. This creates selectable alert conditions in TradingView's alert dialog and satisfies screener requirements. Messages include the tooltip for context (e.g., which oscillators contributed).
Plots for Screening: Four new plot() statements output the counts (0 if no detection) with display = display.data_window. These appear in the data window and enable screener filters like "value > 0" or "value >= 3" (for strong signals from multiple oscillators). Plots are hidden from the chart to avoid clutter.
No Impact on Performance: Calculations remain efficient, only triggering on confirmed pivots (delayed by lbR bars for accuracy). The max distance (maxDist) prevents outdated pivot comparisons.
Oscillator-Specific Logic
Each oscillator's divergence check uses its respective value (e.g., MACD histogram for MACD, smoothed %D for Stochastic). Users can toggle calculations via boolean inputs, reducing computation if not needed. Here's a table summarizing the oscillators and their roles:
Catatan Rilis
Separate pine Has been removed visible only on chartSkrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.