OPEN-SOURCE SCRIPT
Constant Auto Trendlines (Extended Right)

📈 Constant Auto Trendlines (Extended Right)
This indicator automatically detects market structure by connecting swing highs and lows with permanent, forward-projecting trendlines.
Unlike standard trendline tools that stop at the last pivot, this version extends each trendline infinitely into the future — helping traders visualize where price may react next.
🔍 How It Works
The script identifies pivot highs and lows using user-defined left/right bar counts.
When a new lower high or higher low appears, the indicator draws a line between the two pivots and extends it forward using extend.right.
Each new confirmed trendline stays fixed, creating a historical map of structure that evolves naturally with market action.
Optional filters:
Min Slope – ignore nearly flat trendlines
Show Latest Only – focus on the most relevant trendline
Alerts – get notified when price crosses the most recent uptrend or downtrend line
🧩 Why It’s Useful
This tool helps traders:
Spot emerging trends early
Identify dynamic support/resistance diagonals
Avoid redrawing trendlines manually
Backtest structure breaks historically
⚙️ Inputs
Pivot Left / Right bars
Min slope threshold
Line color, width, and style
Show only latest line toggle
Alert options
This indicator automatically detects market structure by connecting swing highs and lows with permanent, forward-projecting trendlines.
Unlike standard trendline tools that stop at the last pivot, this version extends each trendline infinitely into the future — helping traders visualize where price may react next.
🔍 How It Works
The script identifies pivot highs and lows using user-defined left/right bar counts.
When a new lower high or higher low appears, the indicator draws a line between the two pivots and extends it forward using extend.right.
Each new confirmed trendline stays fixed, creating a historical map of structure that evolves naturally with market action.
Optional filters:
Min Slope – ignore nearly flat trendlines
Show Latest Only – focus on the most relevant trendline
Alerts – get notified when price crosses the most recent uptrend or downtrend line
🧩 Why It’s Useful
This tool helps traders:
Spot emerging trends early
Identify dynamic support/resistance diagonals
Avoid redrawing trendlines manually
Backtest structure breaks historically
⚙️ Inputs
Pivot Left / Right bars
Min slope threshold
Line color, width, and style
Show only latest line toggle
Alert options
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.