OPEN-SOURCE SCRIPT
已更新

Auto Trendlines Pro [Rejection Zone]

5 656
Most trendline indicators connect closing prices or arbitrary points. This one works the way a human trader actually draws trendlines — anchored to swing wick extremes, validated bar by bar, and extended as a rejection zone rather than a single line.

How it works
Pivot highs and lows are detected from wick extremes using a configurable lookback on each side. When two valid pivots are found, the script checks that no wick between them pierced the proposed line, discarding geometrically correct but structurally broken trendlines before they ever appear on screen.
Each trendline is paired with a parallel inner boundary to form a rejection zone. The outer wick line is the hard invalidation level. The inner line represents where the price was actually committed, and the noise band between them is where liquidity was swept but couldn't sustain. This is structurally equivalent to a tilted supply and demand zone, automatically drawn at the angle of the trend.

Hybrid channel width with ATR fallback
The channel width is set by the larger of the two wick-to-body gaps at the anchor pivots. If the two gaps differ by more than a configurable ratio (default 2x), one anchor is flagged as an outlier, and the width falls back to ATR-derived instead. The transition crossfades smoothly between the two methods by default. A dotted inner line signals ATR fallback is active; dashed means the width comes from the actual price structure.

Features
  • Wick-to-wick pivot detection with configurable confirmation length on each side
  • Bar-by-bar line validation so that structurally broken trendlines are discarded before drawing
  • Touch count with ATR-scaled tolerance, with line opacity and star rating (✦✦ through ✦✦✦✦) reflecting how many times the price confirmed the level
  • Rejection zone channel with a true parallel inner boundary and linefill, not a converging wedge
  • Outlier detection with smooth ATR fallback and dotted vs dashed inner line to signal which method is active
  • Slope angle filter as a percentage of ATR per bar, scaling correctly across all instruments and timeframes
  • Break and retest detection on the primary trendline with labelled signals and four alert conditions
  • Price projection label at the right edge of each line showing the current projected price
  • Parallel channel detection between support and resistance lines with configurable slope tolerance and linefill
  • Multi-timeframe pivot mode to detect pivots on a higher timeframe while staying on your current chart


Settings guide
  • Pivot Length 5 to 8: intraday and short-term swing structure
  • Pivot Length 10 to 15: standard swing trading on daily charts
  • Pivot Length 20 and above: major weekly structure
  • Lines Per Side 1: cleanest view with one support and one resistance
  • Lines Per Side 2 or 3: near-term and broader trendline simultaneously
  • Outlier Ratio 2.0: triggers ATR fallback when one anchor gap is twice the other
  • ATR Fallback Width 0.5x: equivalent to a typical clean wick-to-body gap
  • Blend Outlier Transition on: smooth crossfade between methods; off for a hard switch


Reading the zones
  • Price touching the outer wick line but closing inside the zone is still within the noise band with no confirmed break
  • A close beyond the outer wick line is a structural break. Watch for a retest from the other side
  • A close between the two lines is contested; wait for resolution before acting
  • A dotted inner line means channel width is ATR-estimated due to an outlier anchor; dashed means it is derived from the real price structure
發行說明
V2: Bug Fixes
發行說明
V2.5 Bug Fixes
發行說明
V2.5 Updated Chart
發行說明
🔥 Version 3.0 Update: The Hybrid Engine & Precision Alerts Overhaul 🔥
This major update completely rebuilds the underlying math engine of the indicator, resulting in flawless Multi-Timeframe mapping, zero false-positive alerts, and a significantly optimized drawing loop.

✨ Major Improvements:

  • True Multi-Timeframe (MTF) Engine: We completely rewrote the X-axis math. If you enable Higher Timeframe pivots (e.g., Daily lines on a 1-Hour chart), the script now calculates slopes using exact UNIX time instead of bar_index. This permanently fixes the "flattening" or distortion of lines across different time frames.
  • Hybrid Computation Optimization: To keep the indicator lightning-fast, the heavy UNIX time math is only engaged when the MTF setting is turned on. Standard trendlines still use lightweight bar math for maximum performance.
  • Flawless Mathematical Alerts: Replaced TradingView's standard crossover functions with a pure mathematical projection model. This completely eliminates the "fake out" alerts that used to happen when dynamic trendlines redrew themselves to new pivots.


🐛 Bug Fixes & Stability:

  • Fixed Label Ghosting: Break and Retest labels will no longer be left floating in space. Labels are now dynamically linked to the active trendlines and will properly recalculate and anchor themselves as the lines update.
  • Eliminated Memory Crashes: Implemented a strict 4,500-bar safety cap on the historical lookback loops. This prevents the script from ever hitting TradingView's hard 5,000-bar memory limit, ensuring the indicator will never crash during long live sessions.
  • Fixed Pivot Circle Clutter: Corrected a bug where the "Show Pivots from Last N Bars" setting was ignored. The chart will now correctly cull ancient pivot circles, keeping your visual space clean.
發行說明
🚀 Update: Smarter Zone Sizing & Stability

1. Fixed "Vanishing" Zones
  • The fix: The script now compares wick sizes against the ATR (Average True Range) instead of comparing them to each other.
  • The benefit: A normal wick paired with a flat candle (zero wick) will no longer trigger a false "outlier" panic. Your zones will stay fully intact and structurally accurate.

2. New Feature: Minimum Zone Thickness
  • The fix: Added a Min Zone Width (x ATR) setting (Default: 0.15).
  • The benefit: If price pivots on a candle with no wick, the script will enforce a minimum, tradable thickness so the zone doesn't disappear into a useless 1-tick line.

3. True Multi-Timeframe Scaling
  • The benefit: Because these width calculations are now tied to current volatility (ATR), the Rejection Zones will automatically scale perfectly whether you are trading a 1-minute chart or a Weekly chart.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。