Smart Levels

โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ OVERVIEW
Smart Levels is an advanced support and resistance indicator that automatically identifies and displays the most significant price levels based on historical pivot points. Unlike simple pivot indicators, Smart Levels uses intelligent clustering and weighting algorithms to merge nearby extremums and highlight only the most reliable levels that matter for trading decisions.
This indicator emphasizes identifying key price levels where multiple pivot points converge, creating zones of increased probability for price reactions.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง HOW IT WORKS
1. PIVOT POINT DETECTION
The indicator scans historical price data to identify pivot highs and pivot lows using configurable left/right bar parameters. Each detected extremum represents a potential support or resistance point where price previously reversed.
2. INTELLIGENT LEVEL CLUSTERING
KEY INNOVATION: Instead of drawing a line at every pivot point, Smart Levels uses an ATR-based clustering algorithm to merge nearby extremums into consolidated levels.
โข Extremums within a specified percentage of ATR are grouped together
โข The level price is calculated as a weighted average of all contributing pivot points
โข This eliminates visual clutter and focuses on truly significant zones
3. TOUCH-BASED LEVEL RANKING
Levels are ranked by the number of pivot points (touches) that contributed to them:
โข 5+ touches: Strong levels (solid lines, thicker width)
โข 2-4 touches: Moderate levels (dashed lines, standard width)
โข Only levels meeting the minimum touch threshold are displayed
4. LEVEL CLASSIFICATION
Each level is automatically classified based on the types of extremums it contains:
โข ๐ข SUPPORT - Contains only pivot lows (green)
โข ๐ด RESISTANCE - Contains only pivot highs (red)
โข ๐ต MIRROR LEVEL - Contains both highs and lows, indicating a level that has acted as both support and resistance (blue)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ KEY FEATURES
โจ SMART LEVEL DETECTION
โข ATR-Adaptive Clustering: Automatically adjusts merge zones based on market volatility
โข Configurable History: Look back 50-500 bars to find relevant levels
โข Touch-Based Filtering: Only show levels with minimum confirmation (2-10 touches)
โข Top N Display: Automatically displays the strongest 3-20 levels to avoid clutter
๐ DETAILED PRICE INFORMATION
โข Multi-Line Price Labels: Each level shows ALL contributing pivot prices in a vertical list
โข Labels display the exact historical prices that formed the level
โข Visual classification icons (โ support, โ resistance, ๐ mirror)
โข Labels positioned to the right of current price for clear visibility
๐จ VISUAL CUSTOMIZATION
โข Customizable colors for support, resistance, and mirror levels
โข Automatic line styling based on level strength
โข Optional debug mode showing all detected pivot points
โข Highlight feature that marks which extremums contributed to displayed levels
๐ REAL-TIME UPDATES
โข Levels recalculate on every bar for dynamic adaptation
โข Lines extend into the future for forward-looking analysis
โข Information table shows current ATR, merge zone, and level statistics
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ INPUT PARAMETERS
EXTREMUM DETECTION
โข Bars Left (7) - Number of bars to the left for pivot detection (2-20)
โข Bars Right (7) - Number of bars to the right for pivot detection (2-20)
โข Lookback History (200) - How many bars back to analyze for levels (50-500)
LEVEL SETTINGS
โข Merge Percent (0.8% ATR) - Maximum distance to cluster extremums (0.2-3.0%)
โข Minimum Touches (2) - Minimum pivot points required to display a level (2-10)
โข Maximum Levels (10) - How many top levels to display (3-20)
VISUAL OPTIONS
โข Support Color (Green) - Color for support levels
โข Resistance Color (Red) - Color for resistance levels
โข Mirror Color (Blue) - Color for mirror levels
โข Show Debug Pivots - Display all detected pivot points
โข Highlight Used Extremums - Mark extremums that form displayed levels
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ HOW TO USE
BASIC SETUP
1. Add the indicator to your chart (works on any timeframe)
2. Start with default parameters and observe the detected levels
3. Adjust "Minimum Touches" to filter more/less levels
4. Tune "Merge Percent" based on your timeframe and instrument volatility
TRADING APPLICATIONS
1. Entry Timing: Watch for price reactions at identified levels for potential entry points
2. Stop Loss Placement: Place stops beyond strong levels (5+ touches)
3. Target Selection: Use the next significant level as a profit target
4. Breakout Confirmation: Monitor for decisive breaks of strong resistance/support levels
5. Mirror Level Strategy: Blue levels that flip from support to resistance (or vice versa) can provide high-probability setups
INTERPRETATION TIPS
โข Solid thick lines (5+ touches) = Extremely reliable levels with strong historical significance
โข Dashed lines (2-4 touches) = Valid levels but with less confirmation
โข Mirror levels (blue) = Highest probability zones as they've worked in both directions
โข Check the price labels to see the exact historical prices that formed each level
RECOMMENDED SETTINGS BY TIMEFRAME
โข Scalping (1m-5m): Lookback 100-150, Merge 0.5-0.8%, Min Touches 2-3
โข Intraday (15m-1h): Lookback 150-200, Merge 0.8-1.2%, Min Touches 3-4
โข Swing (4h-1D): Lookback 200-300, Merge 1.0-1.5%, Min Touches 3-5
โข Position (1D-1W): Lookback 300-500, Merge 1.5-2.0%, Min Touches 4-6
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ DEBUG FEATURES
Enable the debug options to understand how the indicator works:
โข Show Debug Pivots: Displays small triangles at all detected pivot points (faded)
โข Highlight Used Extremums: Bright colored triangles show which pivots contributed to displayed levels
โข Info Table: Shows current ATR, merge zone size, number of detected extremums, and active levels
These features help you fine-tune parameters and understand why certain levels appear or disappear.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โก TECHNICAL DETAILS
โข Version: Pine Script v5
โข Overlay: Yes (draws directly on price chart)
โข Maximum Lines: 50 (configurable limit)
โข Maximum Labels: 50 (configurable limit)
โข ATR Period: 14 bars (standard volatility measurement)
โข Calculation Method: Weighted average of clustered pivot points
โข Update Frequency: Every bar (dynamic recalculation)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก WHAT MAKES THIS INDICATOR ORIGINAL
1. INTELLIGENT CLUSTERING ALGORITHM
Unlike basic pivot indicators that draw every level, Smart Levels uses ATR-adaptive clustering to merge nearby extremums, highlighting only the most significant zones
2. DETAILED PRICE HISTORY
Multi-line labels show ALL historical prices that formed each level, providing transparency about level formation
3. DYNAMIC STRENGTH VISUALIZATION
Automatic line styling (solid vs dashed, thickness) based on level confirmation strength
4. MIRROR LEVEL DETECTION
Identifies zones that have acted as both support AND resistance, which are statistically more reliable
5. REAL-TIME ADAPTATION
Continuous recalculation ensures levels remain relevant as new price action develops
6. VISUAL DEBUGGING SYSTEM
Comprehensive tools to understand level formation and tune parameters effectively
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ IMPORTANT NOTES
โข This indicator identifies historical support/resistance zones - it does NOT predict future price movements
โข Always combine with other forms of analysis (trend, volume, fundamentals) for trading decisions
โข Levels can break - use proper risk management and stop losses
โข Higher timeframes generally produce more reliable levels
โข On first load, the indicator needs leftBars + rightBars bars to detect the first pivots
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ METHODOLOGY BACKGROUND
This indicator implements a clustering-based approach to support and resistance analysis, which emphasizes:
โข Identifying price levels where multiple extremums converge
โข Focusing on the strongest, most tested levels rather than every minor pivot
โข Using historical price behavior to anticipate future support/resistance
โข Combining level analysis with proper risk management and position sizing
The clustering approach ensures that levels represent genuine zones of supply/demand accumulation rather than isolated price spikes, making them more reliable for trading decisions.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. Dynamic Merge Zone Range
Old: Single fixed value (0.8% ATR)
New:
Min/Max range (0.1% - 5.0% ATR)
1-5 zones auto-distributed between Min and Max
Flexible sensitivity control
2. Multi-Zone Support
Old: 1 level set only
New: Up to 5 independent level sets simultaneously
3. Enhanced Color System
Old: 3 colors (Support/Resistance/Mirror)
New: 15 colors (3 per zone ร 5 zones)
Each zone has distinct color scheme
Easy visual differentiation
4. Touch Price Labels
New Feature:
Shows actual price at each level touch
Positioned above/below bars at extremums
Size options: Tiny/Small/Normal/Large
Color modes: Level Color or Custom
Toggle on/off
5. Cleaner Interface
Old: Statistics table on chart
New: Table removed for clean visualization
6. Zone Markers
New: Each level labeled as Z1-Z5 for easy identification
๐ PRESERVED:
Pivot point detection
ATR-based level clustering
Touch count filtering
Strength-based sorting
Level types (Support/Resistance/Mirror)
Debug mode with pivot highlighting
๐ฏ KEY BENEFITS:
Multi-timeframe analysis in single view
Precise entries with touch price markers
Adaptive range (0.1%-5% ATR) for any volatility
Visual clarity with color-coded zones
Scalable from minimal (1 zone) to complex (5 zones)
1. Dynamic Merge Zone Range
Old: Single fixed value (0.8% ATR)
New:
Min/Max range (0.1% - 5.0% ATR)
1-5 zones auto-distributed between Min and Max
Flexible sensitivity control
2. Multi-Zone Support
Old: 1 level set only
New: Up to 5 independent level sets simultaneously
3. Enhanced Color System
Old: 3 colors (Support/Resistance/Mirror)
New: 15 colors (3 per zone ร 5 zones)
Each zone has distinct color scheme
Easy visual differentiation
4. Touch Price Labels
New Feature:
Shows actual price at each level touch
Positioned above/below bars at extremums
Size options: Tiny/Small/Normal/Large
Color modes: Level Color or Custom
Toggle on/off
5. Cleaner Interface
Old: Statistics table on chart
New: Table removed for clean visualization
6. Zone Markers
New: Each level labeled as Z1-Z5 for easy identification
๐ PRESERVED:
Pivot point detection
ATR-based level clustering
Touch count filtering
Strength-based sorting
Level types (Support/Resistance/Mirror)
Debug mode with pivot highlighting
๐ฏ KEY BENEFITS:
Multi-timeframe analysis in single view
Precise entries with touch price markers
Adaptive range (0.1%-5% ATR) for any volatility
Visual clarity with color-coded zones
Scalable from minimal (1 zone) to complex (5 zones)
Added three independent filters to control which level types are displayed:
โข ๐ Mirror Levels - levels with price bounces in both directions
โข โ Support Levels - levels with only upward bounces (lows only)
โข โ Resistance Levels - levels with only downward bounces (highs only)
Each filter can be toggled on/off independently, allowing traders to:
- Focus on specific level types
- Reduce chart clutter
- Customize analysis based on trading strategy
Filters apply to all zones (Z1-Z5) simultaneously.
Script su invito
Solo gli utenti approvati dall'autore possono accedere a questo script. ร necessario richiedere e ottenere l'autorizzazione per utilizzarlo. Tale autorizzazione viene solitamente concessa dopo il pagamento. Per ulteriori dettagli, seguire le istruzioni dell'autore riportate di seguito o contattare direttamente Smart-Day-Trader.
TradingView NON consiglia di acquistare o utilizzare uno script a meno che non si abbia piena fiducia nel suo autore e se ne comprenda il funzionamento. ร inoltre possibile trovare alternative gratuite e open source nei nostri script della community.
Istruzioni dell'autore
Declinazione di responsabilitร
Script su invito
Solo gli utenti approvati dall'autore possono accedere a questo script. ร necessario richiedere e ottenere l'autorizzazione per utilizzarlo. Tale autorizzazione viene solitamente concessa dopo il pagamento. Per ulteriori dettagli, seguire le istruzioni dell'autore riportate di seguito o contattare direttamente Smart-Day-Trader.
TradingView NON consiglia di acquistare o utilizzare uno script a meno che non si abbia piena fiducia nel suo autore e se ne comprenda il funzionamento. ร inoltre possibile trovare alternative gratuite e open source nei nostri script della community.