OPEN-SOURCE SCRIPT
Double Inside Body Candles with Box & Alert + 5-Bar Lines

This indicator identifies Double Inside Body Candle patterns, where:
Candle 1 is completely inside Candle 2,
Candle 2 is completely inside Candle 3 (the parent candle),
Candle 3 has a real body (not a doji or negligible body size).
Once the pattern is detected:
A label appears below the current candle.
A highlight box is drawn around Candle 3 (the parent candle) body range.
Horizontal lines are drawn from the top and bottom of Candle 3’s body and extend forward for exactly 5 bars to visualize potential breakout levels.
The script also detects and highlights breakouts:
🔼 Bullish breakout: if price closes above Candle 3's body high.
🔽 Bearish breakout: if price closes below Candle 3's body low.
Alerts are available for:
Double Inside Body pattern detection
Bullish breakout
Bearish breakout
Traders can use this script to identify consolidation periods (double inside bars), then monitor for breakout opportunities in either direction, using the 5-bar lines as short-term breakout levels.
Candle 1 is completely inside Candle 2,
Candle 2 is completely inside Candle 3 (the parent candle),
Candle 3 has a real body (not a doji or negligible body size).
Once the pattern is detected:
A label appears below the current candle.
A highlight box is drawn around Candle 3 (the parent candle) body range.
Horizontal lines are drawn from the top and bottom of Candle 3’s body and extend forward for exactly 5 bars to visualize potential breakout levels.
The script also detects and highlights breakouts:
🔼 Bullish breakout: if price closes above Candle 3's body high.
🔽 Bearish breakout: if price closes below Candle 3's body low.
Alerts are available for:
Double Inside Body pattern detection
Bullish breakout
Bearish breakout
Traders can use this script to identify consolidation periods (double inside bars), then monitor for breakout opportunities in either direction, using the 5-bar lines as short-term breakout levels.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.