OPEN-SOURCE SCRIPT
Trendline Breakout Indicator [Dots3Red]

Trendline Breakout Indicator is an upgraded version of the existing "Trendline Breakout with Volume Confirmation [Dots3Red]".
What is this indicator for?
The indicator is built to automatically detect and visualize trending price channels, both bullish and bearish. It draws channels (or polygons, optionally) across pivot-based trendlines, tracks them in real time, and signals when price breaks out of them with a certain N% (can be confirmed by volume activity too).
How does it work?
The indicator identifies pivot highs and lows of a configurable length. Consecutive pivots of the same type (lows for bullish, highs for bearish) form a trendline. Each trendline is then extended bar by bar until the price breaks it.
Channel mode draws a parallel channel around the trendline, where the channel width is determined by the maximum price deviation from the trendline within the channel's range - not a fixed offset. This means every channel is fitted to actual price behavior.
Polygon mode instead fills the area between the trendline and the extreme price reached within it, giving a triangular wedge shape that highlights price compression.
Channels are color-coded: cyan/teal for bullish, red/pink for bearish.
Breakout Detection
A breakout is confirmed when:
When a breakout occurs, the channel is frozen and drawn at its final shape. A BO▲ / BO▼ label marks the breakout bar.
Only channels that have persisted for at least the configured minimum length (in bars) are drawn - this filters out insignificant short-lived moves
Volume Confirmation
Volume is measured relative to its 20-bar moving average. When volume at the breakout bar exceeds the Volume % Breakout threshold, a bar visualization is drawn at the breakout point.
Key Inputs
The code has been cleaned so as not to contain duplicate execution functions.
Example

Above is the Trendline analysis of the Nvidia stock behaviour.
The following configurable parameters have been chosen:
It is interesting to observe what happens when two opposite channels overlap. From Jan 2025 to mid May 2025, the stock was in a clear bearish channel, yet a bullish channel started to develop since April 2025. The bearish channel got broken on May 13, 2025, at the time when the bullish channel had already been established - a more powerful signal to enter long.
Changing indicator settings might give different visual interpretations, especially the slope factor and the minimum pivot length.
What is this indicator for?
The indicator is built to automatically detect and visualize trending price channels, both bullish and bearish. It draws channels (or polygons, optionally) across pivot-based trendlines, tracks them in real time, and signals when price breaks out of them with a certain N% (can be confirmed by volume activity too).
How does it work?
The indicator identifies pivot highs and lows of a configurable length. Consecutive pivots of the same type (lows for bullish, highs for bearish) form a trendline. Each trendline is then extended bar by bar until the price breaks it.
Channel mode draws a parallel channel around the trendline, where the channel width is determined by the maximum price deviation from the trendline within the channel's range - not a fixed offset. This means every channel is fitted to actual price behavior.
Polygon mode instead fills the area between the trendline and the extreme price reached within it, giving a triangular wedge shape that highlights price compression.
Channels are color-coded: cyan/teal for bullish, red/pink for bearish.
Breakout Detection
A breakout is confirmed when:
- For bullish channels: price closes below the lower trendline by more than the configured Breakout %
- For bearish channels: price closes above the upper trendline by more than the configured Breakout %
When a breakout occurs, the channel is frozen and drawn at its final shape. A BO▲ / BO▼ label marks the breakout bar.
Only channels that have persisted for at least the configured minimum length (in bars) are drawn - this filters out insignificant short-lived moves
Volume Confirmation
Volume is measured relative to its 20-bar moving average. When volume at the breakout bar exceeds the Volume % Breakout threshold, a bar visualization is drawn at the breakout point.
Key Inputs
- Channel / Polygon - Switch between channel and polygon visualization mode
- Breakout % - How far price must close beyond the trendline to confirm a breakout
- Slope Factor - Minimum slope required for a trendline to be considered a valid trend
- Pivot Length - Lookback length for pivot high/low detection
- Channel Min Length - Minimum bar length a channel must reach before being drawn
- Volume % Breakout - Volume spike threshold relative to the 20-bar average (can be toggle on/off)
The code has been cleaned so as not to contain duplicate execution functions.
Example
Above is the Trendline analysis of the Nvidia stock behaviour.
The following configurable parameters have been chosen:
- 2.5% for price break out
- 1.02 for slope factor
- 3 for Pivot length
- 20 for min channel's length
- 30% for min volume % breakout indicaton
It is interesting to observe what happens when two opposite channels overlap. From Jan 2025 to mid May 2025, the stock was in a clear bearish channel, yet a bullish channel started to develop since April 2025. The bearish channel got broken on May 13, 2025, at the time when the bullish channel had already been established - a more powerful signal to enter long.
Changing indicator settings might give different visual interpretations, especially the slope factor and the minimum pivot length.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Connect the dots to elevate your trading.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Connect the dots to elevate your trading.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.