OPEN-SOURCE SCRIPT
更新済 Trendline MTF Optimized

1️⃣ What the Script Does
The script automatically draws trendlines connecting pivot highs and lows for multiple timeframes on your chart.
Pivot highs → connect recent tops
Pivot lows → connect recent bottoms
It also shows a legend so you can see which line belongs to which timeframe.
Why it’s useful:
Helps spot trend direction across multiple timeframes at a glance.
Highlights support and resistance levels automatically.
Useful for scalpers, swing traders, and multi-timeframe analysis.
2️⃣ Inputs the User Can Adjust
Input What it Means for the User
Pivot Left Bars How many bars to the left the script checks to confirm a pivot. More bars → stronger pivot, slower reaction.
Pivot Right Bars How many bars to the right it checks. Similar effect as left bars.
Show Debug Pivot Labels Shows the exact pivot values on the chart. Good for learning or checking accuracy.
Show Legend Shows the small table with line symbols and timeframes. Helps you quickly know which line belongs to which timeframe.
3️⃣ Timeframes
The script automatically calculates pivot points for multiple timeframes:
1 min, 3 min, 5 min, 15 min, 30 min, 1 hour, 4 hours, 1 day
Each timeframe gets its own color and line thickness. This helps distinguish them visually.
4️⃣ How Trendlines Are Drawn
Pivot Highs (Red lines): Connects the previous top to the most recent top on that timeframe.
Pivot Lows (Green lines): Connects the previous bottom to the most recent bottom.
If there’s no previous pivot yet, it just starts the line at the first pivot detected.
Optional debug labels show the price and timeframe of each pivot.
User Benefit: You can instantly see short-term and long-term trendlines without manual drawing.
5️⃣ Legend Table
Shows which line corresponds to which timeframe.
Uses small bar symbols (▁▁▁▁▁, ▂▂▂▂▂, etc.) to match line thickness.
Placed at the top-right corner by default.
User Benefit: Even if the chart is cluttered, you always know which line represents which timeframe.
6️⃣ How a User Reads It on the Chart
Red line going down → recent highs are decreasing → short-term downtrend.
Green line going up → recent lows are increasing → short-term uptrend.
Multiple lines of different thickness/colors → different timeframes.
Crossovers of lines or areas where green and red lines converge → potential support/resistance zones.
7️⃣ User Actionable Tips
Adjust left/right bars for sensitivity:
Lower bars → trendlines react faster (good for scalping).
Higher bars → trendlines smoother (good for swing trades).
Use debug labels initially to see pivot points.
Check legend to quickly identify which line belongs to which timeframe.
Combine trendlines with other indicators (like RSI, ADX) for better signals.
✅ Summary for Users
“This script automatically draws support/resistance trendlines across multiple timeframes, labels pivots optionally, and shows a legend so you know which line belongs to which timeframe. Adjust pivot sensitivity to match your trading style.”
The script automatically draws trendlines connecting pivot highs and lows for multiple timeframes on your chart.
Pivot highs → connect recent tops
Pivot lows → connect recent bottoms
It also shows a legend so you can see which line belongs to which timeframe.
Why it’s useful:
Helps spot trend direction across multiple timeframes at a glance.
Highlights support and resistance levels automatically.
Useful for scalpers, swing traders, and multi-timeframe analysis.
2️⃣ Inputs the User Can Adjust
Input What it Means for the User
Pivot Left Bars How many bars to the left the script checks to confirm a pivot. More bars → stronger pivot, slower reaction.
Pivot Right Bars How many bars to the right it checks. Similar effect as left bars.
Show Debug Pivot Labels Shows the exact pivot values on the chart. Good for learning or checking accuracy.
Show Legend Shows the small table with line symbols and timeframes. Helps you quickly know which line belongs to which timeframe.
3️⃣ Timeframes
The script automatically calculates pivot points for multiple timeframes:
1 min, 3 min, 5 min, 15 min, 30 min, 1 hour, 4 hours, 1 day
Each timeframe gets its own color and line thickness. This helps distinguish them visually.
4️⃣ How Trendlines Are Drawn
Pivot Highs (Red lines): Connects the previous top to the most recent top on that timeframe.
Pivot Lows (Green lines): Connects the previous bottom to the most recent bottom.
If there’s no previous pivot yet, it just starts the line at the first pivot detected.
Optional debug labels show the price and timeframe of each pivot.
User Benefit: You can instantly see short-term and long-term trendlines without manual drawing.
5️⃣ Legend Table
Shows which line corresponds to which timeframe.
Uses small bar symbols (▁▁▁▁▁, ▂▂▂▂▂, etc.) to match line thickness.
Placed at the top-right corner by default.
User Benefit: Even if the chart is cluttered, you always know which line represents which timeframe.
6️⃣ How a User Reads It on the Chart
Red line going down → recent highs are decreasing → short-term downtrend.
Green line going up → recent lows are increasing → short-term uptrend.
Multiple lines of different thickness/colors → different timeframes.
Crossovers of lines or areas where green and red lines converge → potential support/resistance zones.
7️⃣ User Actionable Tips
Adjust left/right bars for sensitivity:
Lower bars → trendlines react faster (good for scalping).
Higher bars → trendlines smoother (good for swing trades).
Use debug labels initially to see pivot points.
Check legend to quickly identify which line belongs to which timeframe.
Combine trendlines with other indicators (like RSI, ADX) for better signals.
✅ Summary for Users
“This script automatically draws support/resistance trendlines across multiple timeframes, labels pivots optionally, and shows a legend so you know which line belongs to which timeframe. Adjust pivot sensitivity to match your trading style.”
リリースノート
Just a small correction on symbols on chart for better viewオープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。