OPEN-SOURCE SCRIPT
Auto Trend Lines + Signals + Supertrend

Auto Trend Lines + Signals + Supertrend — a TradingView indicator that combines three tools in one overlay.
Macro Trend
Detects significant pivot highs and lows using wide lookback windows (default: 10 bars left, 5 right). Connects consecutive lower highs into a resistance trendline (red) and higher lows into a support trendline (green). All lines accumulate on the chart, preserving the full history of trend levels. Options: wick or body pivots, log scale, forward extension, color and style.
Micro Trend
Same logic on a shorter scale (default: 4 left, 2 right) — catches smaller waves within the macro move. Drawn as dotted lines by default to distinguish them visually from macro lines.
Trendline Signals
When price crosses a trendline, a marker appears:
B (large, cyan) — Strong Buy: price broke above a macro resistance line
S (large, red) — Strong Sell: price broke below a macro support line
b (small, green) — Weak Buy: price broke above a micro resistance line
s (small, orange) — Weak Sell: price broke below a micro support line
Supertrend
Standard Supertrend based on ATR × multiplier. The line trails below price in an uptrend and above price in a downtrend, changing color on direction flips. Small circles mark each flip. Default settings: ATR period 10, multiplier 3.0 — both adjustable.
Alerts
Six individual alert conditions (Strong Buy, Strong Sell, Weak Buy, Weak Sell, ST Buy, ST Sell) plus two combined ones — "Any TL Signal" and "Any ST Signal".
Macro Trend
Detects significant pivot highs and lows using wide lookback windows (default: 10 bars left, 5 right). Connects consecutive lower highs into a resistance trendline (red) and higher lows into a support trendline (green). All lines accumulate on the chart, preserving the full history of trend levels. Options: wick or body pivots, log scale, forward extension, color and style.
Micro Trend
Same logic on a shorter scale (default: 4 left, 2 right) — catches smaller waves within the macro move. Drawn as dotted lines by default to distinguish them visually from macro lines.
Trendline Signals
When price crosses a trendline, a marker appears:
B (large, cyan) — Strong Buy: price broke above a macro resistance line
S (large, red) — Strong Sell: price broke below a macro support line
b (small, green) — Weak Buy: price broke above a micro resistance line
s (small, orange) — Weak Sell: price broke below a micro support line
Supertrend
Standard Supertrend based on ATR × multiplier. The line trails below price in an uptrend and above price in a downtrend, changing color on direction flips. Small circles mark each flip. Default settings: ATR period 10, multiplier 3.0 — both adjustable.
Alerts
Six individual alert conditions (Strong Buy, Strong Sell, Weak Buy, Weak Sell, ST Buy, ST Sell) plus two combined ones — "Any TL Signal" and "Any ST Signal".
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。