OPEN-SOURCE SCRIPT
Support Resistance with Order Blocks

Indicator Description
Professional Price Level Detection for Smart Trading. Master the Markets with Precision Support/Resistance and Order Block Analysis . It provides traders with clear visual cues for potential reversal and breakout areas, combining both retail and institutional trading concepts into one powerful tool.
The Support & Resistance with Order Blocks indicator is a versatile Pine Script tool designed to empower traders with clear, actionable insights into key market levels. By combining advanced pivot-based support and resistance (S/R) detection with order block (OB) filtering, this indicator delivers clean, high-probability zones for entries, exits, and reversals. With customizable display options (boxes or lines) and intuitive settings, it’s perfect for traders of all styles—whether you’re scalping, swing trading, or investing long-term. Overlay it on your TradingView chart and elevate your trading strategy today!
________________________________________
Key Features
✅ Dynamic Support/Resistance - Auto-adjusting levels based on price action
✅ Smart Order Block Detection - Identifies institutional buying/selling zones
✅ Dual Display Modes - Choose between Boxes or Clean Lines for different chart styles
✅ Customizable Sensitivity - Adjust detection parameters for different markets
✅ Broken Level Markers - Clearly shows when key levels are breached
✅ Timeframe-Adaptive - Automatically adjusts for daily/weekly charts
1. Dynamic Support & Resistance Detection
Identifies critical S/R zones using pivot high/low calculations with adjustable look back periods.
Visualizes active S/R zones with distinct colors and labels ("Support" or "Resistance" for boxes, lines for cleaner charts).
Marks broken S/R levels as "Br S" (broken support) or "Br R" (broken resistance) when historical display is enabled, aiding in breakout and reversal analysis.
2. Smart Order Block Identification
Detects bullish and bearish order blocks based on significant price movements (default: ±0.3% over 5 candles).
Highlights institutional buying/selling zones with customizable colors, displayed as boxes or lines.
Filters out overlapping OB zones to keep your chart clutter-free.
3. Dual Display Options
Boxes or Lines: Choose to display S/R and OB as boxes for detailed zones or lines for a minimalist view.
Line Width Customization: Adjust line widths for S/R and OB (1–5 pixels) for optimal visibility.
Color Customization: Tailor colors for active/broken S/R and bullish/bearish OB zones.
4. Advanced Overlap Filtering
Ensures S/R zones don’t overlap with OB zones or other S/R levels, providing only the most relevant levels.
Limits the number of active zones (default: 10) to maintain chart clarity.
5. Historical S/R Visualization
Optionally display broken S/R levels with distinct colors and labels ("Br S" or "Br R") to track historical price reactions.
Broken levels are dynamically updated and removed (or retained) based on user settings.
6. Timeframe Adaptability
Automatically adjusts pivot detection for daily/weekly timeframes (40-candle look back) versus shorter timeframes (20-candle look back).
Works seamlessly across all asset classes (stocks, forex, crypto, etc.) and timeframes.
________________________________________
How It Works
• Support & Resistance:
Uses ta.pivothigh and ta.pivotlow to detect significant price pivots, with a user-defined look back (default: 5 candles post-pivot).
Plots S/R as boxes (with labels "Support" or "Resistance") or lines, extending to the current bar for real-time relevance.
Broken S/R levels are marked with adjusted colors and labels ("S" or "R" for boxes, "Br S" or "Br R" for lines when historical display is enabled).
• Order Blocks:
Identifies OB based on strong price movements over 4 candles, plotted as boxes or lines at the candle’s midpoint.
Validates OB to prevent overlap, ensuring only significant zones are displayed.
Removes OB zones when price breaks through, keeping the chart focused on active levels.
• Customization:
Toggle S/R and OB visibility, adjust detection sensitivity, and set maximum active zones (4–50).
Fine-tune line widths and colors for a personalized chart experience.
________________________________________
Why Use This Indicator?
• Precision Trading: Pinpoint high-probability entry/exit zones with filtered S/R and OB levels.
• Clean Charts: Overlap filtering and zone limits reduce clutter, focusing on key levels.
• Versatile Display: Switch between boxes for detailed zones or lines for simplicity, with adjustable line widths.
• Institutional Edge: Leverage OB detection to align with institutional activity for smarter trades.
• User-Friendly: Intuitive settings and clear visuals make it accessible for beginners and pros alike.
________________________________________
Settings Overview________________________________________
⚙ Input Parameters
Settings Overview
Display Options:
Display Type: Choose "Boxes" or "Lines" for S/R and OB visualization.
S/R Line Width: Set line thickness for S/R lines (1–5 pixels, default: 2).
OB Line Width: Set line thickness for OB lines (1–5 pixels, default: 2).
Order Block Options:
Show Order Block: Enable/disable OB display.
Bull/Bear OB Colors: Customise border and fill colors for bullish and bearish OB zones.
Support/Resistance Options:
Show S/R: Toggle active S/R zones.
Show Historical S/R: Display broken S/R levels, marked as "Br S" or "Br R" for lines.
Detection Period: Set candle lookback for pivot detection (4–50, default: 5).
Max Active Zones: Limit active S/R and OB zones (4–50, default: 10).
Colors: Customise active and broken S/R colors for clear differentiation.
________________________________________
How to Use
1. Add to Chart: Apply the indicator to your TradingView chart.
2. Customize Settings:
o Select "Boxes" or "Lines" for your preferred display style.
o Adjust line widths, colors, and detection parameters to suit your trading style.
o Enable "Show Historical S/R" to track broken levels with "Br S" and "Br R" labels.
3. Analyze Levels:
o Use support zones (green) for buy entries and resistance zones (red) for sell entries.
o Monitor OB zones for institutional activity, signaling potential reversals or continuations.
o Watch for "Br S" or "Br R" labels to identify breakout opportunities.
4. Combine with Other Tools: Pair with trend indicators, volume analysis, or price action for a robust strategy.
5. Monitor Breakouts: Trade breakouts when price breaches S/R or OB zones, with historical labels providing context.
________________________________________
Example Use Cases
• Swing Trading: Use S/R and OB zones to identify entry/exit points, with historical broken levels for context.
• Breakout Trading: Trade price breaks through S/R or OB, using "Br S" and "Br R" labels to confirm reversals.
• Scalping: Adjust detection period for faster S/R and OB identification on lower timeframes.
________________________________________
• Performance: Optimized for all timeframes, with best results on 5M, 15M, 30M, 1H, 4H, or daily charts for swing trading.
• Compatibility: Works with any asset class and TradingView chart.
________________________________________
Get Started
Transform your trading with Support & Resistance with Order Blocks! Add it to your chart, customize it to your style, and trade with confidence. For questions or feedback, drop a comment on TradingView or message the author. Happy trading! 🚀
________________________________________
Disclaimer: This indicator is for educational and informational purposes only. Always conduct your own analysis and practice proper risk management before trading.
Professional Price Level Detection for Smart Trading. Master the Markets with Precision Support/Resistance and Order Block Analysis . It provides traders with clear visual cues for potential reversal and breakout areas, combining both retail and institutional trading concepts into one powerful tool.
The Support & Resistance with Order Blocks indicator is a versatile Pine Script tool designed to empower traders with clear, actionable insights into key market levels. By combining advanced pivot-based support and resistance (S/R) detection with order block (OB) filtering, this indicator delivers clean, high-probability zones for entries, exits, and reversals. With customizable display options (boxes or lines) and intuitive settings, it’s perfect for traders of all styles—whether you’re scalping, swing trading, or investing long-term. Overlay it on your TradingView chart and elevate your trading strategy today!
________________________________________
Key Features
✅ Dynamic Support/Resistance - Auto-adjusting levels based on price action
✅ Smart Order Block Detection - Identifies institutional buying/selling zones
✅ Dual Display Modes - Choose between Boxes or Clean Lines for different chart styles
✅ Customizable Sensitivity - Adjust detection parameters for different markets
✅ Broken Level Markers - Clearly shows when key levels are breached
✅ Timeframe-Adaptive - Automatically adjusts for daily/weekly charts
1. Dynamic Support & Resistance Detection
Identifies critical S/R zones using pivot high/low calculations with adjustable look back periods.
Visualizes active S/R zones with distinct colors and labels ("Support" or "Resistance" for boxes, lines for cleaner charts).
Marks broken S/R levels as "Br S" (broken support) or "Br R" (broken resistance) when historical display is enabled, aiding in breakout and reversal analysis.
2. Smart Order Block Identification
Detects bullish and bearish order blocks based on significant price movements (default: ±0.3% over 5 candles).
Highlights institutional buying/selling zones with customizable colors, displayed as boxes or lines.
Filters out overlapping OB zones to keep your chart clutter-free.
3. Dual Display Options
Boxes or Lines: Choose to display S/R and OB as boxes for detailed zones or lines for a minimalist view.
Line Width Customization: Adjust line widths for S/R and OB (1–5 pixels) for optimal visibility.
Color Customization: Tailor colors for active/broken S/R and bullish/bearish OB zones.
4. Advanced Overlap Filtering
Ensures S/R zones don’t overlap with OB zones or other S/R levels, providing only the most relevant levels.
Limits the number of active zones (default: 10) to maintain chart clarity.
5. Historical S/R Visualization
Optionally display broken S/R levels with distinct colors and labels ("Br S" or "Br R") to track historical price reactions.
Broken levels are dynamically updated and removed (or retained) based on user settings.
6. Timeframe Adaptability
Automatically adjusts pivot detection for daily/weekly timeframes (40-candle look back) versus shorter timeframes (20-candle look back).
Works seamlessly across all asset classes (stocks, forex, crypto, etc.) and timeframes.
________________________________________
How It Works
• Support & Resistance:
Uses ta.pivothigh and ta.pivotlow to detect significant price pivots, with a user-defined look back (default: 5 candles post-pivot).
Plots S/R as boxes (with labels "Support" or "Resistance") or lines, extending to the current bar for real-time relevance.
Broken S/R levels are marked with adjusted colors and labels ("S" or "R" for boxes, "Br S" or "Br R" for lines when historical display is enabled).
• Order Blocks:
Identifies OB based on strong price movements over 4 candles, plotted as boxes or lines at the candle’s midpoint.
Validates OB to prevent overlap, ensuring only significant zones are displayed.
Removes OB zones when price breaks through, keeping the chart focused on active levels.
• Customization:
Toggle S/R and OB visibility, adjust detection sensitivity, and set maximum active zones (4–50).
Fine-tune line widths and colors for a personalized chart experience.
________________________________________
Why Use This Indicator?
• Precision Trading: Pinpoint high-probability entry/exit zones with filtered S/R and OB levels.
• Clean Charts: Overlap filtering and zone limits reduce clutter, focusing on key levels.
• Versatile Display: Switch between boxes for detailed zones or lines for simplicity, with adjustable line widths.
• Institutional Edge: Leverage OB detection to align with institutional activity for smarter trades.
• User-Friendly: Intuitive settings and clear visuals make it accessible for beginners and pros alike.
________________________________________
Settings Overview________________________________________
⚙ Input Parameters
Settings Overview
Display Options:
Display Type: Choose "Boxes" or "Lines" for S/R and OB visualization.
S/R Line Width: Set line thickness for S/R lines (1–5 pixels, default: 2).
OB Line Width: Set line thickness for OB lines (1–5 pixels, default: 2).
Order Block Options:
Show Order Block: Enable/disable OB display.
Bull/Bear OB Colors: Customise border and fill colors for bullish and bearish OB zones.
Support/Resistance Options:
Show S/R: Toggle active S/R zones.
Show Historical S/R: Display broken S/R levels, marked as "Br S" or "Br R" for lines.
Detection Period: Set candle lookback for pivot detection (4–50, default: 5).
Max Active Zones: Limit active S/R and OB zones (4–50, default: 10).
Colors: Customise active and broken S/R colors for clear differentiation.
________________________________________
How to Use
1. Add to Chart: Apply the indicator to your TradingView chart.
2. Customize Settings:
o Select "Boxes" or "Lines" for your preferred display style.
o Adjust line widths, colors, and detection parameters to suit your trading style.
o Enable "Show Historical S/R" to track broken levels with "Br S" and "Br R" labels.
3. Analyze Levels:
o Use support zones (green) for buy entries and resistance zones (red) for sell entries.
o Monitor OB zones for institutional activity, signaling potential reversals or continuations.
o Watch for "Br S" or "Br R" labels to identify breakout opportunities.
4. Combine with Other Tools: Pair with trend indicators, volume analysis, or price action for a robust strategy.
5. Monitor Breakouts: Trade breakouts when price breaches S/R or OB zones, with historical labels providing context.
________________________________________
Example Use Cases
• Swing Trading: Use S/R and OB zones to identify entry/exit points, with historical broken levels for context.
• Breakout Trading: Trade price breaks through S/R or OB, using "Br S" and "Br R" labels to confirm reversals.
• Scalping: Adjust detection period for faster S/R and OB identification on lower timeframes.
________________________________________
• Performance: Optimized for all timeframes, with best results on 5M, 15M, 30M, 1H, 4H, or daily charts for swing trading.
• Compatibility: Works with any asset class and TradingView chart.
________________________________________
Get Started
Transform your trading with Support & Resistance with Order Blocks! Add it to your chart, customize it to your style, and trade with confidence. For questions or feedback, drop a comment on TradingView or message the author. Happy trading! 🚀
________________________________________
Disclaimer: This indicator is for educational and informational purposes only. Always conduct your own analysis and practice proper risk management before trading.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
mail Id : satyambeed@gmail.com
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
mail Id : satyambeed@gmail.com
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
WhatsApp +919270007010
Telegram : @AI_Trend_My_Friend forms.gle/H5FUra2tFHn3WR8u6
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.