OPEN-SOURCE SCRIPT
Dresteghamat:Adaptive Multi-TF Decision Engine

**Dresteghamat: Adaptive Multi-Timeframe Decision Engine**
This open-source indicator is an algorithmic decision-support system designed to filter market noise by quantifying three core market dimensions: **Regime**, **Direction**, and **Exhaustion**.
**⚠️ Technical Note on Originality:**
This script solves the "Timeframe Irrelevance" problem found in standard dashboards. Instead of using static HTF references, it implements a custom **"Adaptive Context Engine"** (see lines 245-270 in source code). It calculates the user's current `timeframe.multiplier` and dynamically maps the mathematically relevant Higher Timeframes.
* *Innovation:* A 5m chart automatically weights 15m/1H structure, whereas a 1H chart weights 4H/Daily structure. This dynamic logic is proprietary and ensures contextual accuracy.
---
### 🛠️ Logic & Calculation Methodology
The script does not simply overlay indicators. It processes raw market data through a **Weighted Scoring Engine** (lines 275-285) to output a unified market state.
**1. Regime Identification (Volatility Normalized)**
We calculate a custom "Volatility Ratio" to distinguish Trend vs. Range regimes.
* **Logic:** `Range / Smoothed_ATR`.
* **Function:** If Ratio > 2.0, the market is in Expansion (Trend). If < 1.2, it is in Compression (Range). This normalizes volatility across assets (Crypto/Forex/Stocks).
**2. Directional Bias (Composite Metric)**
Direction is calculated via a voting system of three sub-components (lines 80-130):
* **Structural Pivots:** Detects Swing Highs/Lows using a 25-bar lookback to define market structure.
* **Cumulative Body Delta:** Tracks the net buying/selling pressure within candle bodies.
* **Micro-Flow:** A short-term (5-bar) momentum filter to detect immediate order flow shifts.
**3. Exhaustion Model (Risk Management)**
The script prevents late entries by calculating an "Exhaustion Score" (lines 150-200). It aggregates:
* **VRSD (Volatility Regime Shift):** Detects when volatility expands > 2 standard deviations (Mean Reversion risk).
* **Volume Decay (VEFF):** Identifies Divergence where price makes new highs on declining Volume MA.
* **RSI/Impulse Divergence:** Standard momentum divergence logic.
**4. The Decision Output (MODE)**
The dashboard renders a final signal based on a hierarchical algorithm:
* **BUY/SELL ONLY:** Triggered when Current Momentum aligns with the Dynamically Selected HTF Structure AND the Exhaustion Score is low.
* **PULLBACK:** Triggered when HTF Structure is bullish, but Current Momentum is bearish (indicating a corrective phase).
* **HTF EXHAUST:** Overrides signals when the Higher Timeframe metrics hit extreme levels.
* **WAIT:** Default state during Range Regimes or conflicting signals.
---
### 📊 Usage Guide
1. Apply to chart (Auto-adapts to any timeframe).
2. **Status Column:** Shows the raw health of the trend (Strong/Weakening/Exhausted).
3. **MODE Column:** Displays the final actionable bias based on the scoring algorithm.
**Disclaimer:** This tool provides statistical analysis based on historical data. It does not guarantee future results.
This open-source indicator is an algorithmic decision-support system designed to filter market noise by quantifying three core market dimensions: **Regime**, **Direction**, and **Exhaustion**.
**⚠️ Technical Note on Originality:**
This script solves the "Timeframe Irrelevance" problem found in standard dashboards. Instead of using static HTF references, it implements a custom **"Adaptive Context Engine"** (see lines 245-270 in source code). It calculates the user's current `timeframe.multiplier` and dynamically maps the mathematically relevant Higher Timeframes.
* *Innovation:* A 5m chart automatically weights 15m/1H structure, whereas a 1H chart weights 4H/Daily structure. This dynamic logic is proprietary and ensures contextual accuracy.
---
### 🛠️ Logic & Calculation Methodology
The script does not simply overlay indicators. It processes raw market data through a **Weighted Scoring Engine** (lines 275-285) to output a unified market state.
**1. Regime Identification (Volatility Normalized)**
We calculate a custom "Volatility Ratio" to distinguish Trend vs. Range regimes.
* **Logic:** `Range / Smoothed_ATR`.
* **Function:** If Ratio > 2.0, the market is in Expansion (Trend). If < 1.2, it is in Compression (Range). This normalizes volatility across assets (Crypto/Forex/Stocks).
**2. Directional Bias (Composite Metric)**
Direction is calculated via a voting system of three sub-components (lines 80-130):
* **Structural Pivots:** Detects Swing Highs/Lows using a 25-bar lookback to define market structure.
* **Cumulative Body Delta:** Tracks the net buying/selling pressure within candle bodies.
* **Micro-Flow:** A short-term (5-bar) momentum filter to detect immediate order flow shifts.
**3. Exhaustion Model (Risk Management)**
The script prevents late entries by calculating an "Exhaustion Score" (lines 150-200). It aggregates:
* **VRSD (Volatility Regime Shift):** Detects when volatility expands > 2 standard deviations (Mean Reversion risk).
* **Volume Decay (VEFF):** Identifies Divergence where price makes new highs on declining Volume MA.
* **RSI/Impulse Divergence:** Standard momentum divergence logic.
**4. The Decision Output (MODE)**
The dashboard renders a final signal based on a hierarchical algorithm:
* **BUY/SELL ONLY:** Triggered when Current Momentum aligns with the Dynamically Selected HTF Structure AND the Exhaustion Score is low.
* **PULLBACK:** Triggered when HTF Structure is bullish, but Current Momentum is bearish (indicating a corrective phase).
* **HTF EXHAUST:** Overrides signals when the Higher Timeframe metrics hit extreme levels.
* **WAIT:** Default state during Range Regimes or conflicting signals.
---
### 📊 Usage Guide
1. Apply to chart (Auto-adapts to any timeframe).
2. **Status Column:** Shows the raw health of the trend (Strong/Weakening/Exhausted).
3. **MODE Column:** Displays the final actionable bias based on the scoring algorithm.
**Disclaimer:** This tool provides statistical analysis based on historical data. It does not guarantee future results.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.