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提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。