OPEN-SOURCE SCRIPT

Multi Timeframe Support and Resistance

569
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
  • 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. اقرأ المزيد في شروط الاستخدام.