OPEN-SOURCE SCRIPT
Diupdate Support Resistance Diagonal

Classic diagonal support and resistance based on pivot points. As a result, they form triangles, wedges, channels and other patterns. Realtime update up to 1 second chart.
Catatan Rilis
Added labels with support and resistance pricesCatatan Rilis
Alerts for crossing support or resistance. You can add alerts from the Tradingview Alert menu at the top of page.Catatan Rilis
Support Resistance DiagonalSupport Resistance Diagonal automatically identifies diagonal support and resistance
boundaries from confirmed price extremes. It is designed to reduce the time spent
manually drawing and updating trend lines while keeping the chart's structural context
visible.
Unlike a simple indicator that connects the two latest pivots, this script evaluates
multiple pairs of pivot highs and lows. Each candidate is checked along the sequence of
intermediate pivot extremes between its anchors. A support candidate is rejected when it
passes above the candle body at an intermediate pivot low, and a resistance candidate is
rejected when it passes below the candle body at an intermediate pivot high. When several
valid lines share the same recent anchor, the script keeps the closer structural boundary:
the higher support or the lower resistance.
The resulting automatic trend lines can outline channels, triangles, wedges, and other
forms of diagonal price structure. The script does not predict direction or generate
buy and sell recommendations.
### Settings
**Maximum lookback (bars)** controls how far into chart history the script searches for
pivot anchors. A larger value can include older structures but requires more processing.
The value is measured in chart bars, so the same number represents a different amount of
clock time on each timeframe.
**Pivot window (bars)** controls the scale of confirmed highs and lows used as anchors.
Lower values are more sensitive and normally produce more local lines. Higher values
select broader price swings and normally produce fewer, more stable lines. The default
value preserves the behavior of the original Classic indicator.
The Style section lets you change support and resistance colors, line width, line style,
transparency, and price-label visibility. These settings change presentation only; they
do not change which lines are selected.
### Alerts
Two alert conditions are available in TradingView's Create Alert dialog:
- Diagonal Support Alert: price closes below a support line after the previous bar's low
remained above that line.
- Diagonal Resistance Alert: price closes above a resistance line after the previous
bar's high remained below that line.
Alerts depend on the lines calculated by the script and should be tested on the intended
symbol and timeframe before use.
### Realtime and recalculation behavior
Pivot anchors require bars on both sides before they are confirmed. The script does not
use an unconfirmed current-bar high or low as a new pivot anchor.
The active set of lines is recalculated on the latest chart bar. As new prices and newly
confirmed pivots become available, a candidate line can move, be replaced by a more
relevant valid boundary, or disappear. The current realtime bar can therefore change the
visible line set before that bar closes. This behavior is part of continuously updating
market structure and should not be described as a guaranteed non-repainting signal.
Changing the chart timeframe recalculates the indicator from that timeframe's bars. It
does not import structure from another timeframe.
### Notes
- Works on any symbol and timeframe supported by TradingView, but useful settings depend
on volatility, timeframe, and available history.
- Very large lookback values require more processing and may reach TradingView execution
limits on dense charts.
- Lines are structural chart-markup tools, not investment advice and not a claim of
future performance.
This version updates the original open-source Classic indicator to Pine Script v6,
removes the obsolete test alert, corrects price-label tick rounding, and adds requested
visual controls while preserving the original line-selection method.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.