OPEN-SOURCE SCRIPT
Multi Timeframe Support and Resistance

Multi Timeframe Support and Resistance
This indicator detects swing-based support and resistance levels from a user-selected timeframe and plots them as horizontal lines on the current chart. It is designed for use on a lower timeframe chart while sourcing levels from a higher timeframe.
How it works
Pivot highs and pivot lows are calculated on the source timeframe using request.security with lookahead_on. Because gaps_off causes pivot values to repeat until a new pivot fires, the indicator tracks the last seen value and records only genuinely new pivots into separate high and low history arrays.
On the final bar, all stored pivots are processed most-recent-first. A clustering filter discards any new level that falls within a configurable percentage of an already-accepted level, preventing duplicate lines at nearly identical prices. The resulting lists are capped at the configured maximum and drawn as horizontal lines spanning a fixed number of bars to the left and right of the current bar.
Each level is classified as resistance if it is above the current source-timeframe close, or support if it is below. Levels within 1.5% of the current price are drawn with a thicker line and full opacity to highlight nearby key zones.
Settings
Works on any symbol and any chart timeframe. The source timeframe should be equal to or higher than the chart timeframe for meaningful results.
This indicator detects swing-based support and resistance levels from a user-selected timeframe and plots them as horizontal lines on the current chart. It is designed for use on a lower timeframe chart while sourcing levels from a higher timeframe.
How it works
Pivot highs and pivot lows are calculated on the source timeframe using request.security with lookahead_on. Because gaps_off causes pivot values to repeat until a new pivot fires, the indicator tracks the last seen value and records only genuinely new pivots into separate high and low history arrays.
On the final bar, all stored pivots are processed most-recent-first. A clustering filter discards any new level that falls within a configurable percentage of an already-accepted level, preventing duplicate lines at nearly identical prices. The resulting lists are capped at the configured maximum and drawn as horizontal lines spanning a fixed number of bars to the left and right of the current bar.
Each level is classified as resistance if it is above the current source-timeframe close, or support if it is below. Levels within 1.5% of the current price are drawn with a thicker line and full opacity to highlight nearby key zones.
Settings
- Source Timeframe — the timeframe from which pivots are sourced (default: 15m)
- Swing Left Bars — bars to the left required to confirm a pivot (default: 10)
- Swing Right Bars — bars to the right required to confirm a pivot (default: 10)
- Max S/R Lines — maximum number of levels drawn for each side (default: 8)
- Zone Cluster % — minimum percentage distance between two accepted levels (default: 0.5%)
- Line Length (bars) — how many bars left and right each line spans (default: 300)
- Show Labels — toggle S/R labels with timeframe and price on or off
- Resistance Color — color for levels above the current price
- Support Color — color for levels below the current price
- Line Width — base thickness of drawn lines (default: 2)
Works on any symbol and any chart timeframe. The source timeframe should be equal to or higher than the chart timeframe for meaningful results.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。