Consecutive CandlesSummary
This indicator helps visualize short-term momentum by automatically drawing boxes around sequences of consecutive same-colored candles (bullish or bearish). It's designed to quickly highlight periods of sustained buying or selling pressure directly on your chart.
How it Works
Consecutive Candle Detection: The script monitors the chart bar by bar, tracking consecutive candles where close > open (bullish) or close < open (bearish).
Box Drawing: When a sequence of same-colored candles reaches a user-defined minimum length (default is 3) and this sequence is then broken by an opposite-colored candle or a doji, a box is drawn.
Box Boundaries:
The top of the box is set to the highest high price reached during the sequence.
The bottom of the box is set to the lowest low price reached during the sequence.
The left edge of the box aligns with the start time of the first candle in the sequence.
The right edge of the box aligns with the end time of the last candle in the sequence.
Stability: Uses xloc = xloc.bar_time to ensure boxes remain accurately anchored to the price bars when zooming or panning the chart.
Real-time Extension: For active sequences meeting the minimum length on the latest developing bar, the box is optionally extended to the right.
Features
Automatically identifies and boxes sequences of 3 or more (customizable) consecutive bullish candles.
Automatically identifies and boxes sequences of 3 or more (customizable) consecutive bearish candles.
Extends box in real-time for active qualifying sequences.
Customizable minimum candle count (>= 2).
Customizable colors for bullish/bearish boxes and borders.
Settings
You can customize the indicator via the Settings menu (gear icon):
Minimum Consecutive Candles: Define how many candles in a row are needed to draw a box (Default: 3).
Bullish Box Color: Set the fill color for boxes around bullish sequences.
Bearish Box Color: Set the fill color for boxes around bearish sequences.
Box Border Color: Set the color for the border of all boxes.
Potential Use Cases
Momentum Identification: Quickly spot periods of strong, uninterrupted buying or selling.
Exhaustion/Reversal Signals: Very long sequences might indicate potential exhaustion, setting up reversal opportunities.
Consolidation Breakouts: A box forming after a period of tight consolidation can highlight the range just before a potential breakout.
Confirmation: Use the boxes as confirmation for entries or exits based on momentum shifts.
Disclaimer: This indicator provides visual aids based on price action. It should not be used as a standalone trading system. Always use indicators in conjunction with your own analysis and risk management rules.