PROTECTED SOURCE SCRIPT
Support and Resistance Lines by Jaehee

📌 SUPPORT AND RESISTANCE LINES — PIVOT-BASED AUTOMATIC S/R WITH DYNAMIC FLIP
🔍 WHAT IT IS
• Automatically detects and plots support and resistance levels based on recent pivot highs and lows
• Groups nearby pivots into channels, then draws the channel mid-point as a horizontal line across the chart
• Resistance lines are shown in red, support lines in blue, both with dual glow layers for visibility
• Includes dynamic S/R flip — when price closes beyond a level, it switches role (support ↔ resistance) and updates its color in real time
⚙️ HOW IT WORKS
• Pivot Detection — Scans recent bars for highs and lows using a configurable lookback period
• Channel Clustering — Merges pivots within a set percentage of the recent range into a single channel
• Strength Filtering — Keeps only channels with a minimum number of touches
• Dynamic Flip — Automatically changes support to resistance and vice versa when broken
• Line Plotting — Draws each channel’s mid-price as a solid line extending in both directions
💡 WHY THIS COMBINATION
• Manual S/R drawing is slow and subjective
• Combines pivot detection, clustering, strength filtering, and dynamic flip to produce objective, evolving levels
• Dual glow layers ensure levels stay visible even on crowded charts
🆚 HOW IT DIFFERS FROM COMMON S/R INDICATORS
• Dynamic clustering — Merges nearby pivots into cleaner, more useful levels
• Strength metric — Ranks levels by the number of touches to reduce noise
• Dual glow layers — Improves readability on any chart theme
• Dynamic S/R flip — Instantly updates line type and color when levels are broken
• Full customization — Adjust pivot period, channel width %, maximum levels, colors, widths, and glow transparency
📖 HOW TO READ IT (CONTEXT, NOT SIGNALS)
• Trend continuation — Break and close beyond a strong level can indicate continuation
• Reversal zones — Multiple strong levels in a tight range can signal potential turning points
• Trading range — Boundaries formed by these lines can define range-bound market conditions
• S/R flip — Support becomes resistance when broken, and resistance becomes support when broken, shown visually in real time
🛠 INPUTS
• Pivot period length
• Source: High/Low or Close/Open
• Maximum pivots and S/R levels
• Maximum channel width %
• Minimum strength (touches)
• Label location offset for pivot markers
• Colors and line widths for resistance, support, and glow layers
🎨 DESIGN NOTES
• Lines extend fully across the chart for continuous reference
• Adjustable glow transparency for both resistance and support
• Optional pivot point labels for cleaner visuals
• Real-time calculation on the selected timeframe
• Automatic visual flip between support and resistance
⚠️ LIMITATIONS AND GOOD PRACTICE
• Past levels do not guarantee future reactions
• Strength is based on historical touches only
• Best used with trend, momentum, or volume confirmation
• Not a strategy — no performance claims
📂 DEFAULTS AND SCOPE
• Works on any OHLCV instrument
• No repainting after levels are confirmed
🔍 WHAT IT IS
• Automatically detects and plots support and resistance levels based on recent pivot highs and lows
• Groups nearby pivots into channels, then draws the channel mid-point as a horizontal line across the chart
• Resistance lines are shown in red, support lines in blue, both with dual glow layers for visibility
• Includes dynamic S/R flip — when price closes beyond a level, it switches role (support ↔ resistance) and updates its color in real time
⚙️ HOW IT WORKS
• Pivot Detection — Scans recent bars for highs and lows using a configurable lookback period
• Channel Clustering — Merges pivots within a set percentage of the recent range into a single channel
• Strength Filtering — Keeps only channels with a minimum number of touches
• Dynamic Flip — Automatically changes support to resistance and vice versa when broken
• Line Plotting — Draws each channel’s mid-price as a solid line extending in both directions
💡 WHY THIS COMBINATION
• Manual S/R drawing is slow and subjective
• Combines pivot detection, clustering, strength filtering, and dynamic flip to produce objective, evolving levels
• Dual glow layers ensure levels stay visible even on crowded charts
🆚 HOW IT DIFFERS FROM COMMON S/R INDICATORS
• Dynamic clustering — Merges nearby pivots into cleaner, more useful levels
• Strength metric — Ranks levels by the number of touches to reduce noise
• Dual glow layers — Improves readability on any chart theme
• Dynamic S/R flip — Instantly updates line type and color when levels are broken
• Full customization — Adjust pivot period, channel width %, maximum levels, colors, widths, and glow transparency
📖 HOW TO READ IT (CONTEXT, NOT SIGNALS)
• Trend continuation — Break and close beyond a strong level can indicate continuation
• Reversal zones — Multiple strong levels in a tight range can signal potential turning points
• Trading range — Boundaries formed by these lines can define range-bound market conditions
• S/R flip — Support becomes resistance when broken, and resistance becomes support when broken, shown visually in real time
🛠 INPUTS
• Pivot period length
• Source: High/Low or Close/Open
• Maximum pivots and S/R levels
• Maximum channel width %
• Minimum strength (touches)
• Label location offset for pivot markers
• Colors and line widths for resistance, support, and glow layers
🎨 DESIGN NOTES
• Lines extend fully across the chart for continuous reference
• Adjustable glow transparency for both resistance and support
• Optional pivot point labels for cleaner visuals
• Real-time calculation on the selected timeframe
• Automatic visual flip between support and resistance
⚠️ LIMITATIONS AND GOOD PRACTICE
• Past levels do not guarantee future reactions
• Strength is based on historical touches only
• Best used with trend, momentum, or volume confirmation
• Not a strategy — no performance claims
📂 DEFAULTS AND SCOPE
• Works on any OHLCV instrument
• No repainting after levels are confirmed
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.