PROTECTED SOURCE SCRIPT
Inside Bar Detector

Inside Bar & Internal Structure
A precise tool for identifying Inside Bars and tracking price range breakouts with internal market structure visualization.
🎯 What It Does
This indicator detects Inside Bars (consolidation patterns) and classifies how price breaks out of established ranges. It helps traders identify:
• Consolidation zones where price is coiling
• Directional breakouts (up or down)
• Liquidity sweeps where price tests both sides before committing to a direction
📊 Key Features
- Inside Bar Detection - Automatically identifies when current bar's range is contained within the previous range
- Range Visualization - Draws dashed rectangle boxes around Inside Bar sequences
- Breakout Classification - Categorizes breaks as: Break High, Break Low, or Expansion
- Sweep Detection - Labels bars that sweep both sides of the range before closing directionally
- Internal Structure Lines - Connects swing highs and lows to visualize market structure
- Statistics Panel - Real-time count of Inside Bars and breakout types
🔧 How It Works
1. Price Range Tracking: The indicator maintains a dynamic price range (high/low) that updates on each breakout
2. Inside Bar Logic: A bar is classified as Inside Bar when its high ≤ range high AND low ≥ range low
3. Breakout Detection:
• Break High: Price closes above the range (bullish)
• Break Low: Price closes below the range (bearish)
• Sweep: Price tests both sides but closes directionally (labeled as Sweep↑ or Sweep↓)
• Expansion: Price breaks both sides but closes in the middle (neutral)
⚙️ Settings
- Display Settings
- Show Inside Bar Box: Toggle rectangle visualization
- Show Statistics: Display count panel
- Show Sweep Labels: Mark liquidity sweep events - Internal Structure Settings
- Show Internal Structure Lines: Connect swing points
- Line Color & Width: Customize appearance - Color Settings
- Inside Bar Box Color & Transparency
📈 How To Use
• Trend Continuation: Look for Inside Bars forming after a strong move, then trade the breakout in the trend direction
• Reversal Setups: Watch for sweep patterns (Sweep↑/Sweep↓) at key levels - these often indicate liquidity grabs before reversals
• Structure Analysis: Use internal structure lines to identify the current market bias
⚠️ Alerts
The indicator includes 4 alert conditions:
• Inside Bar Detected
• Break High (includes bullish sweeps)
• Break Low (includes bearish sweeps)
• Dual Expansion (neutral)
📋 Notes
• Works on all timeframes and instruments
• Consecutive Inside Bars are merged into a single box for cleaner visualization
• Internal structure lines ignore Inside Bars to reduce noise
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations – learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations – learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.