About Auto Trendlines
Unlike trendline tools that stop at the breakout, Auto Trendlines numbers every touch of each line and marks the retest after a break.
How it works
- Swings come from a ZigZag (depth 24, deviation 5 ticks, backstep 3). A line joins two neighboring swing lows (support) or swing highs (resistance) at least 5 bars apart, on wicks or on bodies. It appears once its second point is confirmed by the next swing.
- Rising support and falling resistance are the main lines. Falling support and rising resistance are drawn thin, without signals or alerts.
- Touch: a candle reaches the band of ±0.25 ATR(14) around the line. A touch ends when the whole candle moves 0.5 ATR beyond the band. A touch is a bounce when the candle does not close beyond the band.
- Break: the close is beyond the band and closes stay beyond the line for 5 bars in a row (3, 5 or 10 in the settings). A close back on the other side cancels it.
- Retest: after a break, price moves at least 0.5 ATR away on the broken side, comes back to the line and closes on the broken side, within 20 bars of the break.
- One line per move: a line that breaks between its two points is not drawn, a swing already on a live line does not start a new one, and a line that lies on an earlier one is treated as the same line. Lines end 500 bars after their second point.
- Higher timeframe: its candles are built from this chart's bars and the same rules run on them. Each line is anchored at the chart bar where the higher timeframe high or low was made.
On the chart
- Top right: the current support and resistance closest to price, with timeframe and touches.
- Current lines are solid: thin and faint with 2 touches, normal with 3, thick with 4 or more. Higher timeframe lines are one step thicker, and their newest number shows the timeframe, for example "4h 5".
- A broken line stops at the confirmed break, and a dotted line follows it while a retest is possible.
- Older lines are thin dashed lines with their Break and Retest labels.
- Green is support and red is resistance. The numbers, labels, summary and higher timeframe lines can each be turned off.
Alerts
Use the "Any alert() function call" condition. Touch: the moment price reaches a current line, from the third touch on. Break and Retest: at bar close.
Notes
- The newest swing can still move, so it is never used as a line point.
- Higher timeframe lines use the bars loaded on this chart, so a short history gives fewer of them.
- Lines can differ between data feeds.
How to add it
- 1Open the script page on TradingView with the button above (or here).
- 2Click “Add to favorites” on that page.
- 3On any chart, open Indicators, go to Favorites and click Auto Trendlines [Saikix].