Current Timeframe Support & Resistance v7.1

# Current Timeframe Support & Resistance v7.1
## Overview
Current Timeframe Support & Resistance is an adaptive, volatility-based indicator designed to identify, evaluate, and display meaningful support and resistance zones directly on the price chart.
Rather than drawing static horizontal levels from simple pivot highs and lows, the indicator uses Average True Range (ATR) to confirm significant price reversals, establish price zones, and evaluate how those zones behave when price returns to them.
Each confirmed zone develops a history based on its structural origins, subsequent price interactions, successful bounces, breaks, and rejection strength. An internal scoring system uses this information to distinguish nearby levels from historically significant ones.
The goal is to provide a cleaner, more informative view of market structure by answering three important questions:
- **Where are the nearest support and resistance zones?**
- **Which zones have demonstrated the greatest historical significance?**
- **How has price actually behaved when testing those zones?**
The indicator operates entirely on the chart's current timeframe and adapts automatically to the volatility of the instrument being analyzed.
---
## 1. ATR-Based Swing Detection
The foundation of the indicator is a volatility-adjusted swing detection engine.
Instead of relying on a fixed number of candles to define pivot highs and lows, the indicator tracks developing price extremes and waits for a meaningful reversal before confirming a swing.
A swing high is confirmed when price closes sufficiently below its developing high. A swing low is confirmed when price closes sufficiently above its developing low.
The required reversal distance is calculated using ATR, allowing the detection threshold to adjust to changing market volatility.
This approach helps distinguish meaningful price reversals from smaller fluctuations.
Once a swing is confirmed, its extreme becomes the basis of a new support or resistance zone.
All swing confirmation and zone-event calculations are performed using closed candles.
## 2. Adaptive Support and Resistance Zones
Support and resistance are represented as price ranges rather than exact horizontal lines.
These shaded areas, referred to as *fog zones*, acknowledge that price frequently reacts within a region instead of reversing at one precise price.
Each zone is centered on a confirmed swing level, with its thickness determined by ATR at the time of the swing.
As volatility changes, newly detected zones can have different widths.
When another confirmed swing occurs sufficiently close to an existing zone, the indicator merges the swing into that zone rather than automatically creating a duplicate.
The zone's center and width are updated using the confirmed swing observations, and its structural significance increases.
This allows repeatedly tested price regions to develop into established zones without unnecessarily cluttering the chart.
## 3. Nearest vs. Major Zones
The indicator distinguishes between two categories of support and resistance.
### Nearest Support and Resistance
These are the zones closest to the current reference price.
They are selected primarily by proximity, making them useful for identifying nearby areas where price may encounter buying or selling pressure.
### Major Support and Resistance
Major zones are selected using an internal importance score rather than proximity alone.
The score considers:
- Confirmed swings associated with the zone
- Subsequent zone visits
- Successful bounces
- Breaks through the zone
- Strength of price rejection
- Recency of meaningful zone activity
This allows a historically significant zone to be highlighted even when another zone is closer to price.
Major-zone selection is also constrained by a configurable ATR-based distance, keeping the displayed levels relevant to the current market.
The indicator prevents the same confirmed zone from being displayed twice as both a nearest and major level.
## 4. Zone Interaction and Retest Tracking
A distinguishing feature of this indicator is its ability to evaluate what happens **after a zone has been established**.
The indicator tracks price interactions using a structured event process:
**Approach → Zone Visit → Bounce or Break**
A valid visit begins when price overlaps a zone after approaching from outside its boundaries.
The indicator records whether price approached from above, testing support, or from below, testing resistance.
The outcome is then evaluated using closing prices.
**Successful support bounce:** Price tests a zone from above and closes back above its upper boundary.
**Successful resistance rejection:** Price tests a zone from below and closes back beneath its lower boundary.
**Support break:** Price approaches from above and subsequently closes below the zone's lower boundary.
**Resistance break:** Price approaches from below and subsequently closes above the zone's upper boundary.
These events can resolve on the initial testing candle or on a subsequent candle.
A configurable cooldown helps prevent repeated visits from being counted too closely together.
Importantly, the swing that originally establishes a zone is not automatically counted as a successful retest. Structural formation and subsequent price behavior are tracked separately.
## 5. Historical Retest Reliability
Each displayed zone can show a historical reliability percentage calculated from its recorded bounce and break outcomes.
**Retest Reliability = Successful Bounces / (Successful Bounces + Breaks) × 100**
For example, a zone with eight recorded bounces and two recorded breaks would have an observed retest reliability of 80%.
This provides additional context beyond simply counting how many times price has touched a level.
The percentage represents the zone's recorded historical outcomes under the indicator's event rules. It is not a forecast, a statistical confidence level, or a guarantee that the next test will succeed.
Zones without completed bounce or break outcomes do not display a reliability percentage.
## 6. Dynamic Support and Resistance Roles
Support and resistance are not treated as permanently fixed classifications.
A zone below the current reference price is generally classified as support, while a zone above it is classified as resistance.
When price moves through a zone, its displayed role can change.
Former resistance may become support after price moves above it, while former support may become resistance after price moves below it.
A break does not automatically erase a zone or its history.
This allows the indicator to preserve structurally relevant price regions as market conditions evolve.
## 7. Developing Live Zone
In addition to confirmed zones, the indicator can display a developing zone based on the current unconfirmed swing extreme.
This zone is labeled **LIVE SUP** or **LIVE RES**.
It provides an early visual reference for a potential support or resistance area before the required ATR reversal has confirmed the swing.
Developing zones are visually distinguished from confirmed zones and are not displayed when they overlap an existing confirmed zone.
Because they are provisional, their levels can change as the developing swing progresses. They should not be interpreted as confirmed market structure.
## 8. Zone Statistics and Labels
Each confirmed zone can display a compact label containing its classification, price, and historical statistics.
An example:
**MAJOR SUP 4250.00 | S3 B5 X2 71%**
This indicates:
- **MAJOR SUP:** A major support zone
- **4250.00:** The zone's center price
- **S3:** Three confirmed swings associated with the zone
- **B5:** Five recorded successful bounces
- **X2:** Two recorded breaks
- **71%:** Historical bounce reliability across completed outcomes
These statistics make it easier to evaluate the history behind each displayed level.
The importance score used to select major zones is separate from the reliability percentage.
## 9. Automatic Zone Management
The indicator continuously manages its stored zones to keep the analysis focused on relevant price structure.
Zones that have not experienced meaningful activity within the configured lookback period are removed.
A configurable storage limit also prevents excessive accumulation of zones. When that limit is exceeded, lower-scoring zones are removed first.
Only a selected number of nearest and major zones are displayed, even when additional historical zones remain stored internally.
This helps maintain a readable chart while preserving more structural information for zone selection.
## 10. Customization
Users can adjust the indicator to suit different instruments, timeframes, and trading preferences.
Available settings include:
**Detection:** ATR period, swing confirmation threshold, zone merging distance, historical lookback, and maximum stored zones.
**Zones:** ATR-based zone thickness, number of nearby and major zones, major-zone distance limit, and horizontal display length.
**Scoring:** Individual weights for swing confirmations, zone visits, bounces, breaks, rejection strength, and recency.
**Display:** Support and resistance colors, zone transparency, developing-zone visibility, labels, and statistics.
These controls allow users to choose between more sensitive structural detection and a more selective, less crowded display.
---
## Practical Applications
The indicator is designed to support discretionary technical analysis and can be used to:
- Identify nearby areas of potential price reaction.
- Locate historically significant support and resistance regions.
- Evaluate previous zone behavior before a retest.
- Observe potential support/resistance role reversals.
- Place current price action into a broader structural context.
- Identify potential areas for trade planning, profit targets, or risk management.
Because all calculations use the current chart timeframe, changing timeframes produces a different structural analysis appropriate to that timeframe.
## Important Considerations
Confirmed swings require a completed reversal and are therefore identified after the original price extreme occurs.
Confirmed zone centers, widths, historical statistics, and selections may subsequently change as new swings are merged, interactions are recorded, or older zones expire.
The developing live zone is provisional and can move before confirmation.
The indicator does not generate automatic buy or sell signals, predict future price movements, or guarantee that a support or resistance level will hold.
Historical retest reliability should be interpreted with consideration for the number of recorded outcomes. A high percentage based on very few tests is not necessarily more meaningful than a lower percentage based on a larger history.
**Current Timeframe Support & Resistance is intended as a market-structure analysis and decision-support tool, not a standalone trading system.**
---
*Built with Pine Script v6.*
## Overview
Current Timeframe Support & Resistance is an adaptive, volatility-based indicator designed to identify, evaluate, and display meaningful support and resistance zones directly on the price chart.
Rather than drawing static horizontal levels from simple pivot highs and lows, the indicator uses Average True Range (ATR) to confirm significant price reversals, establish price zones, and evaluate how those zones behave when price returns to them.
Each confirmed zone develops a history based on its structural origins, subsequent price interactions, successful bounces, breaks, and rejection strength. An internal scoring system uses this information to distinguish nearby levels from historically significant ones.
The goal is to provide a cleaner, more informative view of market structure by answering three important questions:
- **Where are the nearest support and resistance zones?**
- **Which zones have demonstrated the greatest historical significance?**
- **How has price actually behaved when testing those zones?**
The indicator operates entirely on the chart's current timeframe and adapts automatically to the volatility of the instrument being analyzed.
---
## 1. ATR-Based Swing Detection
The foundation of the indicator is a volatility-adjusted swing detection engine.
Instead of relying on a fixed number of candles to define pivot highs and lows, the indicator tracks developing price extremes and waits for a meaningful reversal before confirming a swing.
A swing high is confirmed when price closes sufficiently below its developing high. A swing low is confirmed when price closes sufficiently above its developing low.
The required reversal distance is calculated using ATR, allowing the detection threshold to adjust to changing market volatility.
This approach helps distinguish meaningful price reversals from smaller fluctuations.
Once a swing is confirmed, its extreme becomes the basis of a new support or resistance zone.
All swing confirmation and zone-event calculations are performed using closed candles.
## 2. Adaptive Support and Resistance Zones
Support and resistance are represented as price ranges rather than exact horizontal lines.
These shaded areas, referred to as *fog zones*, acknowledge that price frequently reacts within a region instead of reversing at one precise price.
Each zone is centered on a confirmed swing level, with its thickness determined by ATR at the time of the swing.
As volatility changes, newly detected zones can have different widths.
When another confirmed swing occurs sufficiently close to an existing zone, the indicator merges the swing into that zone rather than automatically creating a duplicate.
The zone's center and width are updated using the confirmed swing observations, and its structural significance increases.
This allows repeatedly tested price regions to develop into established zones without unnecessarily cluttering the chart.
## 3. Nearest vs. Major Zones
The indicator distinguishes between two categories of support and resistance.
### Nearest Support and Resistance
These are the zones closest to the current reference price.
They are selected primarily by proximity, making them useful for identifying nearby areas where price may encounter buying or selling pressure.
### Major Support and Resistance
Major zones are selected using an internal importance score rather than proximity alone.
The score considers:
- Confirmed swings associated with the zone
- Subsequent zone visits
- Successful bounces
- Breaks through the zone
- Strength of price rejection
- Recency of meaningful zone activity
This allows a historically significant zone to be highlighted even when another zone is closer to price.
Major-zone selection is also constrained by a configurable ATR-based distance, keeping the displayed levels relevant to the current market.
The indicator prevents the same confirmed zone from being displayed twice as both a nearest and major level.
## 4. Zone Interaction and Retest Tracking
A distinguishing feature of this indicator is its ability to evaluate what happens **after a zone has been established**.
The indicator tracks price interactions using a structured event process:
**Approach → Zone Visit → Bounce or Break**
A valid visit begins when price overlaps a zone after approaching from outside its boundaries.
The indicator records whether price approached from above, testing support, or from below, testing resistance.
The outcome is then evaluated using closing prices.
**Successful support bounce:** Price tests a zone from above and closes back above its upper boundary.
**Successful resistance rejection:** Price tests a zone from below and closes back beneath its lower boundary.
**Support break:** Price approaches from above and subsequently closes below the zone's lower boundary.
**Resistance break:** Price approaches from below and subsequently closes above the zone's upper boundary.
These events can resolve on the initial testing candle or on a subsequent candle.
A configurable cooldown helps prevent repeated visits from being counted too closely together.
Importantly, the swing that originally establishes a zone is not automatically counted as a successful retest. Structural formation and subsequent price behavior are tracked separately.
## 5. Historical Retest Reliability
Each displayed zone can show a historical reliability percentage calculated from its recorded bounce and break outcomes.
**Retest Reliability = Successful Bounces / (Successful Bounces + Breaks) × 100**
For example, a zone with eight recorded bounces and two recorded breaks would have an observed retest reliability of 80%.
This provides additional context beyond simply counting how many times price has touched a level.
The percentage represents the zone's recorded historical outcomes under the indicator's event rules. It is not a forecast, a statistical confidence level, or a guarantee that the next test will succeed.
Zones without completed bounce or break outcomes do not display a reliability percentage.
## 6. Dynamic Support and Resistance Roles
Support and resistance are not treated as permanently fixed classifications.
A zone below the current reference price is generally classified as support, while a zone above it is classified as resistance.
When price moves through a zone, its displayed role can change.
Former resistance may become support after price moves above it, while former support may become resistance after price moves below it.
A break does not automatically erase a zone or its history.
This allows the indicator to preserve structurally relevant price regions as market conditions evolve.
## 7. Developing Live Zone
In addition to confirmed zones, the indicator can display a developing zone based on the current unconfirmed swing extreme.
This zone is labeled **LIVE SUP** or **LIVE RES**.
It provides an early visual reference for a potential support or resistance area before the required ATR reversal has confirmed the swing.
Developing zones are visually distinguished from confirmed zones and are not displayed when they overlap an existing confirmed zone.
Because they are provisional, their levels can change as the developing swing progresses. They should not be interpreted as confirmed market structure.
## 8. Zone Statistics and Labels
Each confirmed zone can display a compact label containing its classification, price, and historical statistics.
An example:
**MAJOR SUP 4250.00 | S3 B5 X2 71%**
This indicates:
- **MAJOR SUP:** A major support zone
- **4250.00:** The zone's center price
- **S3:** Three confirmed swings associated with the zone
- **B5:** Five recorded successful bounces
- **X2:** Two recorded breaks
- **71%:** Historical bounce reliability across completed outcomes
These statistics make it easier to evaluate the history behind each displayed level.
The importance score used to select major zones is separate from the reliability percentage.
## 9. Automatic Zone Management
The indicator continuously manages its stored zones to keep the analysis focused on relevant price structure.
Zones that have not experienced meaningful activity within the configured lookback period are removed.
A configurable storage limit also prevents excessive accumulation of zones. When that limit is exceeded, lower-scoring zones are removed first.
Only a selected number of nearest and major zones are displayed, even when additional historical zones remain stored internally.
This helps maintain a readable chart while preserving more structural information for zone selection.
## 10. Customization
Users can adjust the indicator to suit different instruments, timeframes, and trading preferences.
Available settings include:
**Detection:** ATR period, swing confirmation threshold, zone merging distance, historical lookback, and maximum stored zones.
**Zones:** ATR-based zone thickness, number of nearby and major zones, major-zone distance limit, and horizontal display length.
**Scoring:** Individual weights for swing confirmations, zone visits, bounces, breaks, rejection strength, and recency.
**Display:** Support and resistance colors, zone transparency, developing-zone visibility, labels, and statistics.
These controls allow users to choose between more sensitive structural detection and a more selective, less crowded display.
---
## Practical Applications
The indicator is designed to support discretionary technical analysis and can be used to:
- Identify nearby areas of potential price reaction.
- Locate historically significant support and resistance regions.
- Evaluate previous zone behavior before a retest.
- Observe potential support/resistance role reversals.
- Place current price action into a broader structural context.
- Identify potential areas for trade planning, profit targets, or risk management.
Because all calculations use the current chart timeframe, changing timeframes produces a different structural analysis appropriate to that timeframe.
## Important Considerations
Confirmed swings require a completed reversal and are therefore identified after the original price extreme occurs.
Confirmed zone centers, widths, historical statistics, and selections may subsequently change as new swings are merged, interactions are recorded, or older zones expire.
The developing live zone is provisional and can move before confirmation.
The indicator does not generate automatic buy or sell signals, predict future price movements, or guarantee that a support or resistance level will hold.
Historical retest reliability should be interpreted with consideration for the number of recorded outcomes. A high percentage based on very few tests is not necessarily more meaningful than a lower percentage based on a larger history.
**Current Timeframe Support & Resistance is intended as a market-structure analysis and decision-support tool, not a standalone trading system.**
---
*Built with Pine Script v6.*
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.