OPEN-SOURCE SCRIPT
Telah dikemas kini

Dynamic Support and Resistance with Trend Lines

15 993
Dynamic Support and Resistance with Trend Lines (DSRTL)

1. Introduction & Methodology
The DSRTL indicator is designed to provide a multidimensional analysis of market structure. Unlike traditional tools that rely solely on price pivots, this script combines Static Volume-based Zones with Dynamic Trend Lines to evaluate the price's position relative to critical market components.

The S/R Identification Technique
Instead of standard pivot points, DSRTL utilizes Volume Analysis to highlight areas of significant trader participation:
- Strategy A:
Matrix Climax: Identifies candles within the lookback period that are near price extremes (Highs/Lows) and coincide with significant buying or selling volume.
- Strategy B:
Volume Extremes: Detects candles with the absolute highest buy/sell volumes within the selected lookback window, creating extreme volume-based S/R zones.
- Result:
This creates Support/Resistance (S/R) zones that are validated by actual market activity, not just price geometry.

Dynamic Trend Lines
To complement the static zones, the indicator employs two adaptive channel methods:
- Pivot Span: Connects recent significant pivots for a fast, reactive trend corridor.
- 5-Point Channel: Segments the lookback period into 5 parts to perform a linear regression analysis, creating a stable and statistically significant channel.

2. Volume Calculation Methodology
Accurate S/R detection requires distinguishing Buy Volume from Sell Volume. DSRTL offers two calculation modes:

- Geometry (Source File): Estimates buy/sell volume based on the Close price's position relative to the High/Low of the candle.
Note: This is an approximation that works on all plan types as it does not require intrabar data.

- Intrabar (Precise): Analyzes historical lower-timeframe data (e.g., 15S) to calculate intrabar-based volume deltas with higher precision compared to the geometric method.

Note: This offers superior accuracy. It requires access to historical intrabar data (depending on your plan limits). For the best analytical results, use this mode if available.

3. The Smart Matrix Engine (3D Analysis)
The core of DSRTL is its dashboard, powered by the "Smart Matrix Engine." This engine evaluates the current price in a multi-layer market structure context (Static Volume Zones + Dynamic Channels + Volume Metrics).:

A. S-State (Static): Where is the price relative to the Volume S/R zones?
B. D-State (Dynamic): Where is the price relative to the Trend Channels?

How to read the Matrix Map:
The dashboard displays a 5x5 grid representing 25 possible market scenarios.
- Rows (S1-S5): Represent the Static State (S1=Breakout, S3=Mid-Range, S5=Breakdown).
- Columns (D1-D5): Represent the Dynamic State (D1=Overextended Up, D3=Neutral, D5=Overextended Down).
- Active Cell: Marked with a dot, indicating the specific intersection of price action and market structure.

4. Matrix Interpretations (The 25 Scenarios)
Below is the detailed logic for every possible state displayed on the dashboard, explaining the Title, Bias, and actionable Signal.

Section I: S1 - Static Breakout (Price > Static Resistance)
The price has cleared the static volume resistance zone.


- S1 / D1: HYPER EXTENSION
Bias: Extreme Bullish
Signal: Caution: Exhaustion Risk. Trail stops tight.

- S1 / D2: RESISTANCE CLASH
Bias: Bullish
Signal: Breakout confirmed but facing immediate dynamic resistance.

- S1 / D3: CHANNEL BREAKOUT
Bias: Strong Bullish
Signal: Ideal Trend Continuation. Look to buy dips.

- S1 / D4: SMART PULLBACK
Bias: Bullish (Pullback)
Signal: A pullback occurring after a breakout. Strong buy opportunity.

- S1 / D5: CONFLICT (DIV)
Bias: Conflict/Reversal
Signal: Major Divergence. Static breakout is failing against dynamic structure. High Risk.

Section II: S2 - Inside Static Resistance
The price is currently testing the overhead resistance zone.


- S2 / D1: WEAK SPIKE
Bias: Neutral/Bullish
Signal: Testing resistance, but short-term overextended.

- S2 / D2: IRON FORTRESS (R)
Bias: Rejection Risk
Signal: Double Resistance (Static + Dynamic). High probability of rejection.

- S2 / D3: TESTING RES
Bias: Neutral
Signal: Consolidating at resistance. Wait for a clear break or rejection.

- S2 / D4: COMPRESSION (UP)
Bias: Conflict (Squeeze)
Signal: Squeezed between Static Resistance and Dynamic Support. Volatility imminent.

- S2 / D5: RES vs DOWN-TREND
Bias: Bearish
Signal: Strong downtrend meeting static resistance. Potential Short entry.

Section III: S3 - Mid-Range
The price is floating between significant Static Support and Resistance.


- S3 / D1: OVERBOUGHT RANGE
Bias: Rejection Risk (OB)
Signal: Overextended within the range. Potential fade (short).

- S3 / D2: RANGE HIGH LIMIT
Bias: Neutral/Bearish
Signal: At the top of the dynamic channel. Look for rejection signs.

- S3 / D3: NEUTRAL / CHOPPY
Bias: Neutral
Signal: Dead Center. Low probability environment. Avoid trading.

- S3 / D4: RANGE DIP BUY
Bias: Neutral/Bullish
Signal: At the bottom of the dynamic channel. Look for bounce signs.

- S3 / D5: WEAK RANGE (OS)
Bias: Bounce Risk (OS)
Signal: Oversold within the range. Potential fade (long).

Section IV: S4 - Inside Static Support
The price is currently testing the floor support zone.


- S4 / D1: SUP vs UP-TREND
Bias: Bullish
Signal: Strong uptrend meeting static support. Potential Long entry.

- S4 / D2: COMPRESSION (DN)
Bias: Conflict (Squeeze)
Signal: Squeezed between Static Support and Dynamic Resistance. Volatility imminent.

- S4 / D3: TESTING SUPPORT
Bias: Neutral
Signal: Consolidating at support. Wait for a bounce or breakdown.

- S4 / D4: IRON FLOOR (S)
Bias: Bounce Risk
Signal: Double Support (Static + Dynamic). High probability of a bounce.

- S4 / D5: WEAK DIP
Bias: Neutral/Bearish
Signal: Testing support, but short-term oversold.

Section V: S5 - Static Breakdown (Price < Static Support)
The price has dropped below the static volume support zone.


- S5 / D1: CONFLICT (DIV)
Bias: Conflict/Reversal
Signal: Major Divergence. Static breakdown is failing. High Risk.

- S5 / D2: BEAR PULLBACK
Bias: Bearish (Pullback)
Signal: A pullback occurring after a breakdown. Strong selling opportunity.

- S5 / D3: CHANNEL BREAKDOWN
Bias: Strong Bearish
Signal: Ideal Trend Continuation (Down). Sell rallies.

- S5 / D4: SUPPORT CLASH
Bias: Bearish
Signal: Breakdown confirmed but facing immediate dynamic support.

- S5 / D5: HYPER DROP (VOID)
Bias: Extreme Bearish
Signal: Caution: Climax risk. Trail stops for shorts.

DISCLAIMER & EDUCATIONAL PURPOSE

This indicator is strictly an educational tool designed to visualize complex market structure concepts. Its primary purpose is to help traders "bridge the gap" between academic theory and real-time market behavior by providing a visual representation of support, resistance, and volume dynamics.

Please Note:
1. Not a Trading Strategy: This script is an analytical assistant, not a standalone "Black Box" trading system. It does not generate buy or sell signals that should be followed blindly.
2. No Financial Advice: The data provided by this tool is for informational purposes only. It is not a recommendation to buy or sell any asset.
3. Risk Warning: Trading involves significant risk. Always use your own judgment, perform your own technical analysis, and use proper risk management. Do not use this tool as the sole basis for your trading decisions.
4. Data Precision & Platform Limits: The "Intrabar (Precise)" calculation mode relies on high-resolution historical data to provide exact results. Access to this specific data depth depends entirely on your platform's subscription capabilities. If your plan does not support this level of historical intrabar data, the Precise mode may have limited coverage. In that case, you should switch to "Geometry" mode for a fully populated view.
Nota Keluaran
Release Notes: Stability Patch (Critical Fix)

Runtime Error & Data Synchronization Fix

1. The Issue (Symptom)
Users utilizing the "Intrabar (Precise)" calculation method occasionally encountered a critical runtime error: "The requested historical offset is beyond the historical buffer's limit."
This occurred specifically when the script attempted to calculate support/resistance levels on the very first tick of execution or during timeframe changes, before the lower-timeframe (LTF) data had fully buffered.

2. The Diagnosis (Root Cause)
The script's main loop was strictly enforcing the "Universal Lookback Length" (default: 100 bars) for data collection. However, the TradingView engine loads LTF data asynchronously.
- Scenario: The user requests a 100-bar lookback.
- Reality: The engine has only buffered 72 bars of LTF history at that exact millisecond.
- Crash: Accessing index 73 triggered an "Out of Bounds" memory exception.

3. The Solution (Patch)
We implemented a "Dynamic Lookback Clamping" mechanism to synchronize the calculation loop with the available data stream.
- Logic: The script now dynamically calculates an "effective_len" by comparing the user's target length against the actual available history (ltf_cov_bars).
- Implementation: effective_len = math.min(universal_len, ltf_cov_bars)
- Benefit: The indicator now automatically adapts its lookback range based on available data, eliminating crashes while preserving full precision as more history loads naturally.
Nota Keluaran
Global Update: Native Multi-Language Support

TradingView is a truly global ecosystem, connecting millions of traders from every corner of the world. We believe that professional technical analysis should be accessible to everyone, regardless of language barriers. To align with this universal spirit, the Dynamic Support and Resistance with Trend Lines (DSRTL) indicator has been upgraded with a robust Localization Engine.

This major update introduces a built-in translation system that dynamically adapts the entire interface—including the Dashboard, Signal Interpretations, and Bias Contexts—into your native language. Whether you are analyzing Matrix Resistance or Channel Breakouts, the insights are now clearer and more immediate.

New Feature: 10 Supported Languages
You can now select your preferred language directly from the settings menu. The script fully supports:

1. English (Default)
2. Türkçe (Turkish)
3. Русский (Russian)
4. Deutsch (German)
5. Français (French)
6. Italiano (Italian)
7. Español (Spanish)
8. العربية (Arabic)
9. فارسی (Persian)
10. עברית (Hebrew)

Technical Note
The translation logic is implemented via an optimized Dictionary Function within the Pine Script code, ensuring that this added versatility comes with zero impact on calculation speed or rendering performance.

A Note to Our Global Community
While we have launched with these 10 major languages to serve a broad audience, we recognize that the TradingView family is vast and diverse. If your native language is not yet included, please accept our sincere apologies. We are committed to making this tool accessible to everyone—feel free to leave a comment below requesting your language, and we will do our best to include it in future updates.
Nota Keluaran
DSRTL-ML Script Updates & Changelog

1. Fixed "Table Position" Dropdown Menu:
- Added the missing options parameter to the dash_pos input variable.
- Users can now select all table positions (Top/Middle/Bottom + Left/Center/Right) directly from the settings menu.

2. Removed Visible Unicode Artifacts:
- Deleted the conditional logic that inserted the \u200E (Left-to-Right Mark) character. It was being rendered as literal text in the dashboard for RTL languages instead of functioning as a hidden control character.

3. Re-engineered RTL Text Formatting (Persian/Arabic/Hebrew):
- Implemented a specific logic block for Right-to-Left languages (is_rtl).
- The string concatenation order was reversed and customized to fix visual alignment issues in TradingView.
- New Format: The code now strips the default (R): / (S): prefixes from the translation keys and reconstructs the string as (Symbol) [Price Range] : Label.
- Visual Result: This ensures that for Persian, Arabic, and Hebrew, the text aligns to the Right, the price range sits in the Center, and the (R)/(S) symbol appears on the Left.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.