OPEN-SOURCE SCRIPT
Williams %R w/ BB Ultimate [MTF + Hidden Divs]

Williams %R with Bollinger Bands Ultimate [MTF + Hidden & Regular Divergences]
This advanced indicator combines the classic Williams %R oscillator with Bollinger Bands applied to its smoothed value. It is designed to solve the common issues of the standard strategy (whipsaws and lag) by adding Multi-Timeframe capabilities, Confluence Filters, and Dual Divergence detection.
🚀 Key Features
Multi-Timeframe (MTF) Support: Calculate the entire logic (WPR, Bands, Divergences) on a higher timeframe (e.g., 4H) while viewing a lower timeframe chart (e.g., 15m).
No-Repaint Mode: Optional "Wait for closed bar" setting ensures signals are permanent and reliable for alerts.
Dual Divergences: Detects both Regular (Reversal) and Hidden (Trend Continuation) divergences.
Label "R" (Yellow) = Regular Divergence
Label "H" (Orange) = Hidden Divergence
Hybrid Filtering: Filter signals using EMA 200 (Trend), ADX (Volatility), and Volume. Unique feature: choose to calculate these filters on the Indicator's MTF or the Current Chart.
Smart Smoothing: Uses HMA (Hull Moving Average) by default to significantly reduce lag compared to SMA.
Dynamic Visuals: Bars are colored (Green/Red) only when Momentum, Trend, and Volatility filters all align.
💡 How to Trade (Strategy Concept)
This tool is ideal for Swing and Trend Following.
Long Entry: Look for a Green Triangle (Breakout). A stronger signal occurs if preceded by a "D" (Regular Divergence) or "H" (Hidden Bullish Divergence).
Short Entry: Look for a Red Triangle (Breakout).
The "Grey Zone": If the chart bars are grey, the filters (ADX < 20 or Counter-Trend) are actively suppressing low-quality signals. Do not trade.
⚙️ Recommended Settings
Indicator Timeframe: Set to a higher timeframe than your chart (e.g., use "240" (4H) while trading on 15m).
Wait for closed bar: ON (Recommended for validity).
Filter Context: "Current Chart Timeframe" (Allows for precise entries on the lower timeframe while respecting the higher timeframe momentum).
⚠️ Disclaimer This tool is for educational purposes only. Past performance does not guarantee future results. Always manage your risk properly.
Open Source under Mozilla Public License 2.0. Feel free to study the code and adapt it to your needs!
Technical Note regarding Originality & Compliance: To ensure compliance with House Rules regarding Script Originality and Repainting, please note:
Originality: While inspired by the concept of Williams %R + Bollinger Bands, this code is a custom implementation. It introduces original logic not present in standard library scripts, including:
A custom calc_indicator() wrapper to handle complex Multi-Timeframe (MTF) logic.
A hybrid filtering system allowing users to mix contexts (MTF Signal + Current Chart Filter).
A strictly non-repainting state memory for Divergence detection (var variables) specifically adapted for this setup.
Repainting: The script includes a gaps parameter (exposed as "Wait for closed bar") in the request.security() call. The description explicitly warns users that disabling this feature causes repainting, adhering to the publication guidelines.
This advanced indicator combines the classic Williams %R oscillator with Bollinger Bands applied to its smoothed value. It is designed to solve the common issues of the standard strategy (whipsaws and lag) by adding Multi-Timeframe capabilities, Confluence Filters, and Dual Divergence detection.
🚀 Key Features
Multi-Timeframe (MTF) Support: Calculate the entire logic (WPR, Bands, Divergences) on a higher timeframe (e.g., 4H) while viewing a lower timeframe chart (e.g., 15m).
No-Repaint Mode: Optional "Wait for closed bar" setting ensures signals are permanent and reliable for alerts.
Dual Divergences: Detects both Regular (Reversal) and Hidden (Trend Continuation) divergences.
Label "R" (Yellow) = Regular Divergence
Label "H" (Orange) = Hidden Divergence
Hybrid Filtering: Filter signals using EMA 200 (Trend), ADX (Volatility), and Volume. Unique feature: choose to calculate these filters on the Indicator's MTF or the Current Chart.
Smart Smoothing: Uses HMA (Hull Moving Average) by default to significantly reduce lag compared to SMA.
Dynamic Visuals: Bars are colored (Green/Red) only when Momentum, Trend, and Volatility filters all align.
💡 How to Trade (Strategy Concept)
This tool is ideal for Swing and Trend Following.
Long Entry: Look for a Green Triangle (Breakout). A stronger signal occurs if preceded by a "D" (Regular Divergence) or "H" (Hidden Bullish Divergence).
Short Entry: Look for a Red Triangle (Breakout).
The "Grey Zone": If the chart bars are grey, the filters (ADX < 20 or Counter-Trend) are actively suppressing low-quality signals. Do not trade.
⚙️ Recommended Settings
Indicator Timeframe: Set to a higher timeframe than your chart (e.g., use "240" (4H) while trading on 15m).
Wait for closed bar: ON (Recommended for validity).
Filter Context: "Current Chart Timeframe" (Allows for precise entries on the lower timeframe while respecting the higher timeframe momentum).
⚠️ Disclaimer This tool is for educational purposes only. Past performance does not guarantee future results. Always manage your risk properly.
Open Source under Mozilla Public License 2.0. Feel free to study the code and adapt it to your needs!
Technical Note regarding Originality & Compliance: To ensure compliance with House Rules regarding Script Originality and Repainting, please note:
Originality: While inspired by the concept of Williams %R + Bollinger Bands, this code is a custom implementation. It introduces original logic not present in standard library scripts, including:
A custom calc_indicator() wrapper to handle complex Multi-Timeframe (MTF) logic.
A hybrid filtering system allowing users to mix contexts (MTF Signal + Current Chart Filter).
A strictly non-repainting state memory for Divergence detection (var variables) specifically adapted for this setup.
Repainting: The script includes a gaps parameter (exposed as "Wait for closed bar") in the request.security() call. The description explicitly warns users that disabling this feature causes repainting, adhering to the publication guidelines.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.