OPEN-SOURCE SCRIPT
已更新

Support Resistance Diagonal

158 305
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.
發行說明
Added labels with support and resistance prices
發行說明
Alerts for crossing support or resistance. You can add alerts from the Tradingview Alert menu at the top of page.
發行說明
Support Resistance Diagonal

Support 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.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。