已更新
Trendline Bounce PRO [EXCAVO]

Structural Trendline Detection with Entry, Lower Level, and R1–R4 Ratio Levels
The Trendline Bounce PRO automatically identifies support and resistance
trendlines validated by three or more confirmed pivot touches and places a directional
bounce marker when price returns to an established line. Unlike the standard version,
the PRO extends every detected bounce with a structural lower level placed behind the 3rd-touch
candle extreme, four R-multiple ratio levels (R1–R4), and an outcome history overlay
that shows historical outcomes directly on the chart.
This is not a simple two-point line connector. The slope is derived from a best-fit
search across all qualifying pivots, every candidate line is rejected if any candle
between touch points crosses the boundary, and three parallel detection channels reduce
the confirmation delay without sacrificing structural validity.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW TO USE
Step 1 → Add the indicator. Trendlines appear immediately — solid line
is the most recent valid line per direction, dashed lines are
the previous ones (up to Max Lines per Side).
Step 2 → Watch for the bounce marker. A triangle (▲ or ▼) marks the bar
where the third or later touch is detected. The dashboard shows the
quality grade (A / B / C) and current Entry / Lower values.
Step 3 → Read the reference levels. The orange Entry line, red Lower line,
and blue R1–R4 dashed ratio levels extend from the most recent bounce.
The lower level is placed at the 3rd-touch candle extreme plus an ATR buffer.
R1–R4 distances are multiples of the Entry-to-Lower distance.
Step 4 → Review outcome history. Past bounces display their outcomes: solid
blue lines show which ratio levels were reached, dotted lines show active
setups in progress. The display stops at the bar where the lower level was triggered.
Step 5 → Use the Trend Filter and ATR Regime Filter to narrow the context.
Enable Trend Filter to gate bounces by 200 EMA direction.
Enable ATR Regime Filter to suppress detections during extreme
volatility spikes.
Step 6 → Adjust Detection Lookback and Signal Lookback to trade off timing
vs. accuracy. Lower values fire earlier but may produce more noise.
Step 7 → Set alerts to monitor conditions in real time. Use "Any Bounce"
for general monitoring or direction-specific alerts for webhook setups.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW IT CALCULATES
◆ Pivot Detection (Quality Layer)
Swing highs and lows are confirmed using ta.pivothigh() / ta.pivotlow() with
Detection Lookback bars required on each side (default 14). A pivot high at bar B
requires bar B's high to be the maximum of the surrounding 14 bars on both sides.
Up to 60 pivots per direction are stored in a rolling buffer. Pivots older than
Max Pivot Age bars are trimmed at the start of each calculation cycle, preventing
very old price history from anchoring active trendlines.
◆ Best-Slope Trendline Fitting
For each anchor pivot A, the algorithm scans all other pivots B to compute slope:
sl = (price_B - price_A) / (bar_B - bar_A). Slopes steeper than 0.5 x ATR per bar
are rejected. For each valid slope, the algorithm counts how many pivots fall within
ATR x Tolerance of the projected line. The slope maximizing confirmed touch count
(minimum 3) is selected. This finds the line fitting the most pivots rather than
simply connecting two points.
◆ Breakout Rejection Sampling
Once a candidate line passes the touch count test, 60 evenly spaced bars between the
first and last touch are sampled. If any sampled bar's high (for resistance) or low
(for support) exceeds the projected price plus tolerance, the line is rejected. This
catches wick or body violations between pivot points that pure pivot-based validation
would miss.
◆ Three-Channel Bounce Detection
Three parallel channels produce the bounce marker: (1) Quality path — the most recent
quality pivot falls on an established line within the tolerance band. (2) Signal path —
the most recent fast pivot (Signal Lookback, default 5) touches an already-validated
trendline, firing earlier than the full quality confirmation. (3) Real-time path — each
bar, every stored trendline is projected forward; if the current bar's high or low enters
the tolerance band, a detection fires immediately. All three channels require the line to
have been built from quality pivots.
◆ Structural Lower Level Placement
The lower level is calculated as the actual candle extreme at the 3rd-touch bar (low of
the bar for support bounces, high of the bar for resistance bounces), offset by
Lower Buffer x ATR. This anchors the level to the structural point that validated the line,
not to a fixed lookback maximum.
◆ R-Multiple Ratio Levels
Entry price is the close of the 3rd-touch bar. Risk distance is the absolute difference
between entry and lower level. Each ratio level is calculated as:
R_n = Entry + Risk x Ratio_n for bullish, Entry - Risk x Ratio_n for bearish.
Default ratios are R1 = 1.0, R2 = 2.0, R3 = 3.0, R4 = 5.0. All four ratios are
configurable. Ratio levels are fixed at detection time and do not repaint.
◆ Historical Outcome Tracking
Every detected bounce is stored with its entry, lower level, and ratio level prices. On each bar,
the indicator checks whether price has reached each ratio level or the lower level. For historical
bounces, a retroactive scan runs at load time to recover all outcomes from bar history.
Outcome history is drawn in barstate.islast: solid lines show ratio levels reached before the
lower level, dotted lines show active unreached levels, and the lower level line terminates at the bar
where it was triggered.
◆ Trend and Regime Gates
Two optional gates filter the output of all detection channels. The Trend Filter
(200 EMA) passes bullish detections only when close is above the EMA and bearish
detections only when close is below. The ATR Regime Filter computes
ta.percentrank(ATR, 200) / 100 and suppresses all detections when the result exceeds
0.90, blocking entries during the top 10% of volatility events.
◆ Bounce Grade (A / B / C)
Each detected bounce is evaluated at the detection bar: volume ratio = volume /
SMA(volume, 20); wick position = (close - low) / (high - low) for bullish or
(high - close) / (high - low) for bearish. Grade A requires volume ratio >= 2.0
AND wick position >= 0.60. Grade B requires ratio >= 1.5 OR position >= 0.50.
Grade C is assigned otherwise.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ WHAT MAKES IT DIFFERENT
◆ Best-Slope Fitting Across All Pivots
Rather than connecting only two pivots, the algorithm finds the slope that maximizes
the number of confirmed touches. A line touching three pivots approximately is ranked
higher than a line connecting two pivots exactly, because more touches represent
stronger structural significance.
◆ Breakout Rejection via Bar Sampling
Most trendline tools draw a line between any two pivots regardless of what happens in
between. This indicator samples 60 bars between the first and last touch and rejects
any line where a candle crosses the boundary. Only lines price has genuinely respected
are shown.
◆ Max Pivot Age Filter
Pivots older than the configurable age threshold are excluded from trendline fitting.
This prevents trendlines from anchoring on decade-old price levels and keeps the
displayed lines relevant to the current market regime.
◆ Three-Channel Detection for Earlier Timing
Traditional trendline indicators confirm a bounce only after the full pivot lookback
elapses — on a 4H chart with lookback 14, that is 56 hours after the actual low. The
signal detection channel reduces this to 5 bars (20 hours on 4H). The real-time channel
fires on the current bar. Both channels require the line to already be structurally
validated.
◆ Structural Lower Level at the 3rd Touch
The lower level is placed at the actual candle extreme of the bar that confirmed the trendline
touch, plus an ATR-based buffer. This is a structurally meaningful level — the exact
point where the trendline was last tested — rather than an arbitrary lookback maximum.
◆ R-Multiple Ratio Framework
Four configurable R-multiple ratio levels are calculated from the entry-to-lower risk distance.
All ratio levels extend forward from the detection bar on the current bounce and are
shown as historical outcomes on past bounces, making it possible to evaluate trendline
quality across different instruments and timeframes.
◆ Outcome History Overlay
Past bounces display their full outcome on the chart. Solid lines mark ratio levels that were
reached before the lower level. The lower level and Entry lines are short dotted stubs. Dotted
lines show active setups still in progress. The display stops at the lower level bar,
making the performance of each setup immediately visible in historical context.
◆ Minimum Span and Regime Filters
A trendline whose first and last touch are fewer bars apart than the Min Trendline Span
threshold is discarded. The ATR regime gate suppresses detections during the highest-
volatility periods where trendline structure tends to break rather than hold.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ DASHBOARD
Real-time panel (top right corner) showing current state:
Legend table (bottom left) explains every visual element. Both panels can be
toggled independently in Dashboard settings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ SETTINGS
Trendlines
Bounce Detection
Reference Levels
Visualization
Dashboard
Alert Settings
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ ALERTS
All alerts respect the Allow Repainting setting. When OFF, bounces confirm at bar
close only. JSON Alerts sends a structured payload with ticker, price, timeframe,
direction, and grade fields.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best regards,
EXCAVO
The Trendline Bounce PRO automatically identifies support and resistance
trendlines validated by three or more confirmed pivot touches and places a directional
bounce marker when price returns to an established line. Unlike the standard version,
the PRO extends every detected bounce with a structural lower level placed behind the 3rd-touch
candle extreme, four R-multiple ratio levels (R1–R4), and an outcome history overlay
that shows historical outcomes directly on the chart.
This is not a simple two-point line connector. The slope is derived from a best-fit
search across all qualifying pivots, every candidate line is rejected if any candle
between touch points crosses the boundary, and three parallel detection channels reduce
the confirmation delay without sacrificing structural validity.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW TO USE
Step 1 → Add the indicator. Trendlines appear immediately — solid line
is the most recent valid line per direction, dashed lines are
the previous ones (up to Max Lines per Side).
Step 2 → Watch for the bounce marker. A triangle (▲ or ▼) marks the bar
where the third or later touch is detected. The dashboard shows the
quality grade (A / B / C) and current Entry / Lower values.
Step 3 → Read the reference levels. The orange Entry line, red Lower line,
and blue R1–R4 dashed ratio levels extend from the most recent bounce.
The lower level is placed at the 3rd-touch candle extreme plus an ATR buffer.
R1–R4 distances are multiples of the Entry-to-Lower distance.
Step 4 → Review outcome history. Past bounces display their outcomes: solid
blue lines show which ratio levels were reached, dotted lines show active
setups in progress. The display stops at the bar where the lower level was triggered.
Step 5 → Use the Trend Filter and ATR Regime Filter to narrow the context.
Enable Trend Filter to gate bounces by 200 EMA direction.
Enable ATR Regime Filter to suppress detections during extreme
volatility spikes.
Step 6 → Adjust Detection Lookback and Signal Lookback to trade off timing
vs. accuracy. Lower values fire earlier but may produce more noise.
Step 7 → Set alerts to monitor conditions in real time. Use "Any Bounce"
for general monitoring or direction-specific alerts for webhook setups.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW IT CALCULATES
◆ Pivot Detection (Quality Layer)
Swing highs and lows are confirmed using ta.pivothigh() / ta.pivotlow() with
Detection Lookback bars required on each side (default 14). A pivot high at bar B
requires bar B's high to be the maximum of the surrounding 14 bars on both sides.
Up to 60 pivots per direction are stored in a rolling buffer. Pivots older than
Max Pivot Age bars are trimmed at the start of each calculation cycle, preventing
very old price history from anchoring active trendlines.
◆ Best-Slope Trendline Fitting
For each anchor pivot A, the algorithm scans all other pivots B to compute slope:
sl = (price_B - price_A) / (bar_B - bar_A). Slopes steeper than 0.5 x ATR per bar
are rejected. For each valid slope, the algorithm counts how many pivots fall within
ATR x Tolerance of the projected line. The slope maximizing confirmed touch count
(minimum 3) is selected. This finds the line fitting the most pivots rather than
simply connecting two points.
◆ Breakout Rejection Sampling
Once a candidate line passes the touch count test, 60 evenly spaced bars between the
first and last touch are sampled. If any sampled bar's high (for resistance) or low
(for support) exceeds the projected price plus tolerance, the line is rejected. This
catches wick or body violations between pivot points that pure pivot-based validation
would miss.
◆ Three-Channel Bounce Detection
Three parallel channels produce the bounce marker: (1) Quality path — the most recent
quality pivot falls on an established line within the tolerance band. (2) Signal path —
the most recent fast pivot (Signal Lookback, default 5) touches an already-validated
trendline, firing earlier than the full quality confirmation. (3) Real-time path — each
bar, every stored trendline is projected forward; if the current bar's high or low enters
the tolerance band, a detection fires immediately. All three channels require the line to
have been built from quality pivots.
◆ Structural Lower Level Placement
The lower level is calculated as the actual candle extreme at the 3rd-touch bar (low of
the bar for support bounces, high of the bar for resistance bounces), offset by
Lower Buffer x ATR. This anchors the level to the structural point that validated the line,
not to a fixed lookback maximum.
◆ R-Multiple Ratio Levels
Entry price is the close of the 3rd-touch bar. Risk distance is the absolute difference
between entry and lower level. Each ratio level is calculated as:
R_n = Entry + Risk x Ratio_n for bullish, Entry - Risk x Ratio_n for bearish.
Default ratios are R1 = 1.0, R2 = 2.0, R3 = 3.0, R4 = 5.0. All four ratios are
configurable. Ratio levels are fixed at detection time and do not repaint.
◆ Historical Outcome Tracking
Every detected bounce is stored with its entry, lower level, and ratio level prices. On each bar,
the indicator checks whether price has reached each ratio level or the lower level. For historical
bounces, a retroactive scan runs at load time to recover all outcomes from bar history.
Outcome history is drawn in barstate.islast: solid lines show ratio levels reached before the
lower level, dotted lines show active unreached levels, and the lower level line terminates at the bar
where it was triggered.
◆ Trend and Regime Gates
Two optional gates filter the output of all detection channels. The Trend Filter
(200 EMA) passes bullish detections only when close is above the EMA and bearish
detections only when close is below. The ATR Regime Filter computes
ta.percentrank(ATR, 200) / 100 and suppresses all detections when the result exceeds
0.90, blocking entries during the top 10% of volatility events.
◆ Bounce Grade (A / B / C)
Each detected bounce is evaluated at the detection bar: volume ratio = volume /
SMA(volume, 20); wick position = (close - low) / (high - low) for bullish or
(high - close) / (high - low) for bearish. Grade A requires volume ratio >= 2.0
AND wick position >= 0.60. Grade B requires ratio >= 1.5 OR position >= 0.50.
Grade C is assigned otherwise.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ WHAT MAKES IT DIFFERENT
◆ Best-Slope Fitting Across All Pivots
Rather than connecting only two pivots, the algorithm finds the slope that maximizes
the number of confirmed touches. A line touching three pivots approximately is ranked
higher than a line connecting two pivots exactly, because more touches represent
stronger structural significance.
◆ Breakout Rejection via Bar Sampling
Most trendline tools draw a line between any two pivots regardless of what happens in
between. This indicator samples 60 bars between the first and last touch and rejects
any line where a candle crosses the boundary. Only lines price has genuinely respected
are shown.
◆ Max Pivot Age Filter
Pivots older than the configurable age threshold are excluded from trendline fitting.
This prevents trendlines from anchoring on decade-old price levels and keeps the
displayed lines relevant to the current market regime.
◆ Three-Channel Detection for Earlier Timing
Traditional trendline indicators confirm a bounce only after the full pivot lookback
elapses — on a 4H chart with lookback 14, that is 56 hours after the actual low. The
signal detection channel reduces this to 5 bars (20 hours on 4H). The real-time channel
fires on the current bar. Both channels require the line to already be structurally
validated.
◆ Structural Lower Level at the 3rd Touch
The lower level is placed at the actual candle extreme of the bar that confirmed the trendline
touch, plus an ATR-based buffer. This is a structurally meaningful level — the exact
point where the trendline was last tested — rather than an arbitrary lookback maximum.
◆ R-Multiple Ratio Framework
Four configurable R-multiple ratio levels are calculated from the entry-to-lower risk distance.
All ratio levels extend forward from the detection bar on the current bounce and are
shown as historical outcomes on past bounces, making it possible to evaluate trendline
quality across different instruments and timeframes.
◆ Outcome History Overlay
Past bounces display their full outcome on the chart. Solid lines mark ratio levels that were
reached before the lower level. The lower level and Entry lines are short dotted stubs. Dotted
lines show active setups still in progress. The display stops at the lower level bar,
making the performance of each setup immediately visible in historical context.
◆ Minimum Span and Regime Filters
A trendline whose first and last touch are fewer bars apart than the Min Trendline Span
threshold is discarded. The ATR regime gate suppresses detections during the highest-
volatility periods where trendline structure tends to break rather than hold.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ DASHBOARD
Real-time panel (top right corner) showing current state:
- Last Bounce - direction (▲ bullish / ▼ bearish) and quality grade (A/B/C) of the most recent bounce
- Trend (200 EMA) - current price position relative to 200 EMA (▲ Bull / ▼ Bear)
- Lines R / S - count of currently active resistance and support trendlines
- Entry - entry price of the most recent bounce
- Lower - lower level of the most recent bounce
Legend table (bottom left) explains every visual element. Both panels can be
toggled independently in Dashboard settings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ SETTINGS
Trendlines
- Detection Lookback - 14 bars (bars on each side to confirm a quality swing pivot; higher = fewer but stronger lines)
- Max Lines per Side - 5 (maximum number of trendlines shown per direction)
- Tolerance (xATR) - 0.5 (ATR multiple defining how close a pivot must be to the line to count as a touch)
- Min Trendline Span - 20 bars (minimum bars between first and last touch)
- Max Pivot Age (bars) - 1000 (pivots older than this are excluded from trendline fitting)
Bounce Detection
- Min Touches - 3 (minimum confirmed touches before a bounce marker appears)
- Show Grade (A/B/C) - ON (display quality grade in the dashboard)
- Signal Lookback - 5 bars (shorter lookback for faster detection on established lines)
- Trend Filter (200 EMA) - OFF (when ON: bullish bounces above EMA only, bearish below only)
- ATR Regime Filter - OFF (when ON: suppresses detections when ATR is above 90th percentile of last 200 bars)
Reference Levels
- Show Reference Levels - ON (draw entry, lower level, and R1–R4 lines for the most recent bounce)
- Show Historical Levels - ON (display historical outcome lines for past bounces)
- Lower Buffer (xATR) - 0.5 (ATR multiple added as buffer beyond the 3rd-touch candle extreme)
- R1 Ratio - 1.0 (R1 level = entry +/- risk x 1.0)
- R2 Ratio - 2.0
- R3 Ratio - 3.0
- R4 Ratio - 5.0
Visualization
- Support Color - blue (color for support trendlines)
- Resistance Color - red (color for resistance trendlines)
- Bounce Color - orange (color for bounce markers, entry level)
- Bar Coloring - OFF (color bars on bounce detection using direction color)
- Show 200 EMA - OFF (plot 200-bar EMA on the chart)
Dashboard
- Show Dashboard - ON
- Dashboard Position - Top Right (Top Right / Top Left / Bottom Right / Bottom Left)
- Show Legend - ON
Alert Settings
- Allow Repainting - OFF (when OFF, detection confirms at bar close; enable only if monitoring open bars)
- JSON Alerts - OFF (structured JSON payload for webhook automation)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ ALERTS
- Bullish Bounce - price touches a confirmed support trendline for the 3rd+ time
- Bearish Bounce - price touches a confirmed resistance trendline for the 3rd+ time
- Any Bounce - bounce detected in either direction
All alerts respect the Allow Repainting setting. When OFF, bounces confirm at bar
close only. JSON Alerts sends a structured payload with ticker, price, timeframe,
direction, and grade fields.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best regards,
EXCAVO
Disclaimer
Trading involves significant risk. This indicator is a technical analysis tool
and does not constitute financial advice, investment recommendations, or a
guarantee of future results. Past indicator behavior does not guarantee future
performance. Always use proper risk management and your own judgment.
發行說明
- Simplified to a single bounce marker (▲ / ▼) placed at the 3rd or later touch of the active trendline. Removed the entry / lower-level / R1-R4 ratio system, the historical outcome overlay, and the A/B/C grade filter — the chart is now just lines plus markers.- Line-alive check: a trendline that has been closed through by price is automatically dropped, and the next-best valid line takes over. Markers stop appearing on broken lines.
- Anti-spam state: one marker per real rebounce. A candle drifting along the line no longer produces a cluster of markers — the next marker only fires after price has clearly retreated from the line.
- Marker tip is anchored on the line itself (at the projection), not at the bar extreme — easier to read which line was tested.
- Up to the last 5 historical markers per direction, within a TF-adaptive window: 30 bars on 1H and below, 60 bars on 4H, 20 bars on Daily and higher.
- Updated defaults: Max Lines per Side = 1 (cleaner chart), Min Touches = 2, Trend Filter = Auto (enabled automatically on 4H+).
- Alerts: two direction-specific conditions (Bullish Bounce, Bearish Bounce). JSON Alerts now fires once per bar close (non-repainting), use "Any alert() function call" as the event.
- Legend split into separate Support / Resistance bounce-marker rows for clarity.
可在付費空間使用
此指標僅對EXCAVO PRO: Indicators + My Positions 訂閱用戶開放。加入訂閱即可訪問此腳本及EXCAVO的其他腳本。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
可在付費空間使用
此指標僅對EXCAVO PRO: Indicators + My Positions 訂閱用戶開放。加入訂閱即可訪問此腳本及EXCAVO的其他腳本。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。