IBS Multi-Bar Retracement Analyzer v6 Pro

This indicator performs quantitative analysis of Internal Bar Strength (IBS) patterns and their subsequent price retracement behavior under various market regime filters, with multi-bar holding period analysis.
Core Methodology
IBS Calculation: (Close - Low) / (High - Low), measuring where price closed within each bar's range (0.0 = closed at low, 1.0 = closed at high)
Retracement Analysis: For each historical bar meeting filter criteria, the indicator:
Calculates the bar's IBS and assigns it to one of 5 buckets (0.0-0.2, 0.2-0.4, 0.4-0.6, 0.6-0.8, 0.8-1.0)
Analyzes how future price action retraces into that bar's range over 1-5 subsequent bars
Maps retracement levels to 15 extended buckets (from <-0.8 to ≥1.8 range)
Stores results in 5×15 matrices for bullish and bearish reference bars separately
Multi-Bar Enhancement: Instead of single-bar analysis, calculates the combined high/low range across multiple future bars to reveal maximum favorable/adverse excursion over specified holding periods.
Analysis Parameters
Analysis Window: 100-5000 historical bars for statistical analysis
Future Bar Count: 1-5 bars for multi-bar retracement analysis
Bucket System: Standard (0.0-1.0) or Extended (-0.8 to 1.8) retracement ranges
HTF First Bar Handling: Four methods for handling bars where open equals higher timeframe open
Six-Layer Filter System
1. Higher Timeframe Filters
Primary: 1-hour open filter (Above/Below)
Secondary: Configurable timeframe filter (Above/Below)
Special handling for first bar of each HTF period
2. EMA Trend Filter
Configurable length (5-200 periods)
Above/Below EMA positioning
3. ATR Volatility Filters
ATR Multiple Filter: Current ATR vs baseline ATR threshold
Range/ATR Filter: Current bar's range relative to ATR
4. Previous Bar IBS Filter
Analyzes IBS of bar immediately before reference bar
Configurable threshold (0.0-1.0) and direction (Above/Below)
Enables two-bar sequence pattern analysis
Data Architecture
Matrix-Based Storage: 5×15 integer matrices for bullish/bearish data
Rows: IBS buckets of reference bar
Columns: Retracement buckets of future price action
Eliminates manual index calculations and enables row/column operations
Distribution Tracking: Parallel arrays track unfiltered distributions for bias analysis
Validation Metrics: Counts successful multi-bar analyses vs insufficient data cases
Table Output System
Dynamic Table Generation:
Matrix row iteration for clean data display
Conditional formatting based on retracement percentages
Raw counts, percentages, or combined display formats
Distribution Comparison: Shows how filters bias IBS bucket distribution vs baseline data
Filter Status Display: Real-time indication of active filters and their parameters
Research Capabilities
Mean Reversion Analysis:
Identifies optimal holding periods for each IBS range
Reveals edge persistence or degradation over time
Maps adverse excursion patterns
Filter Effectiveness Studies:
Regime-dependent pattern analysis
Filter bias quantification
Multi-dimensional filtering combinations
Sequence Pattern Recognition:
Two-bar IBS sequence analysis (high→low, low→low, etc.)
Momentum vs reversal pattern identification
Risk-Reward Profiling:
Maximum favorable/adverse excursion mapping
Success rate curves across holding periods
Breakout vs reversion classification
Visual Components
Bar Coloring: Real-time indication of bars passing all filter criteria
Optional Plots: EMA and ATR threshold lines
Debug Output: Comprehensive filter status and multi-bar analysis statistics
Technical Implementation
Performance Optimization:
Batch processing on last confirmed historical bar
Matrix operations instead of flattened arrays
Efficient reset functions using built-in matrix operations
Data Validation:
Robust handling of missing or invalid data
Statistical significance tracking
Edge case protection for range calculations
Non-Repainting Design: All filter calculations maintain historical consistency using proper bar referencing and confirmed bar states.
The indicator transforms basic IBS analysis into a sophisticated quantitative research tool for identifying high-probability mean reversion setups under specific market conditions, with statistical validation of edge persistence over varying holding periods.
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 apocalypse-forecaster.
TradingView NON consiglia di pagare o utilizzare uno script a meno che non ci si fidi pienamente del suo autore e non si comprenda il suo funzionamento. Puoi anche trovare alternative gratuite e open-source nei nostri script della comunità.
Istruzioni dell'autore
Attenzione: prima di richiedere l'accesso, leggi la nostra guida per gli script su invito.
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 apocalypse-forecaster.
TradingView NON consiglia di pagare o utilizzare uno script a meno che non ci si fidi pienamente del suo autore e non si comprenda il suo funzionamento. Puoi anche trovare alternative gratuite e open-source nei nostri script della comunità.
Istruzioni dell'autore
Attenzione: prima di richiedere l'accesso, leggi la nostra guida per gli script su invito.