Multi Trendlines from Pivots (>=3 Touches). DaliliIndicator Description
Multi Trendlines from Pivots (≥3 Touches)
This indicator automatically identifies and draws straight support and resistance trendlines based on confirmed price pivots. It is designed to approximate how a disciplined discretionary trader would draw trendlines, but does so algorithmically and consistently.
What it does
1. Pivot-based structure detection
The indicator first identifies swing highs and swing lows using a configurable pivot length. Only confirmed pivots are used, so lines do not repaint.
2. Line construction logic
For each side of the market:
• Pivot highs are used to construct resistance lines (drawn in red).
• Pivot lows are used to construct support lines (drawn in green).
All possible straight lines formed by pairs of pivots are evaluated.
3. Minimum touch requirement
A line is only considered valid if at least 3 pivot points fall on or very near that line. “Near” is defined by a volatility-adjusted tolerance using ATR (Average True Range), so the logic adapts across symbols and timeframes.
4. Multi-line output
The script does not stop at a single trendline. It draws as many valid lines as possible, up to a configurable maximum per side, prioritizing lines with the highest number of touches.
5. Dynamic updating
Lines are rebuilt only when new pivots form. Old lines are removed and replaced as structure evolves, keeping the chart clean and relevant.
Visual output
• Red straight lines: Resistance lines derived from pivot highs.
• Green straight lines: Support lines derived from pivot lows.
• Lines optionally extend to the right, projecting future support or resistance.
What it is not
• It does not curve or smooth lines.
• It does not use regression channels or moving averages.
• It does not rely on candle bodies unless explicitly modified.
• It does not repaint past structure.
Use case
This indicator is best suited for:
• Structural market analysis.
• Identifying confluence zones where multiple trendlines cluster.
• Swing trading and breakout/failure analysis.
• Overlaying objective structure on discretionary price action analysis.
If you want to further constrain it, the next logical refinements would be:
• Only downward-sloping resistance and upward-sloping support.
• Requiring touches to be higher highs or lower lows.
• Switching touches from pivots to raw candle highs/lows.
• Enforcing minimum bar separation between touches.
All of those can be layered on without changing the core architecture.
Indicateur Pine Script®






















