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
リリースノート
🆕 Constant Auto Trendlines – Major UpgradeConstant Auto Trendlines x5 (Extended Right) + Slope Labels
What’s new in this update:
✅ Proper Slope Engine
Slope is now calculated correctly as price units per bar using bar_index.
Much more consistent across symbols & timeframes.
📐 Slope Filter (Min Slope)
New input is in ticks per bar, not raw price.
Example: 1.0 = 1 tick per bar (very gentle filter).
Set to 0 to disable filtering and show all lines.
🏷 Slope Labels for Latest Lines
Optional labels on the most recent uptrend & downtrend lines.
Choose how slope is displayed:
Price/Bar
Degrees
ATR/Bar (slope normalised by volatility).
🧠 Cleaner Behaviour
Lines no longer “disappear” unexpectedly when you change Min Slope.
Trendline logic itself is unchanged – only the slope math & display got upgraded.
🎯 Multi-Set Version (x5)
New variant lets you run up to 5 independent trendline sets in one indicator.
Each set has its own:
Pivot Left / Right
Max Lines per side
Min Slope (ticks per bar)
Enable/Disable toggle
Perfect for mixing HTF structure, intraday levels & micro scalper lines without stacking lots of separate indicators.
リリースノート
✅ Quick Fix Update – Slope Label Stability PatchFixed a runtime error caused by slope labels referencing bar indices far in the past.
Slope labels now anchor safely at the current bar, eliminating “bar index too far” errors.
Cleaned up indentation + formatting to improve Pine stability.
No functional changes to the trendline logic — just a reliability improvement for users using slope labels.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。