OPEN-SOURCE SCRIPT

Auto Trend Lines + Signals + Supertrend

8 736
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".

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.