DRT Feature Engine: Core Mathematical Specification
1. Initial Balance (IB) & Defining Range (DR / IDR)
The Initial Balance covers the first 12 5-minute bars (1 hour) of each session.
- DR (Defining Range): Based on complete bar wicks: $$dr\_open = open_0, \quad dr\_close = close_{N-1}$$ $$dr\_high = \max_{i}(high_i), \quad dr\_low = \min_{i}(low_i)$$ $$dr\_oc = \begin{cases} +1 & \text{if } dr\_close \ge dr\_open \\ -1 & \text{if } dr\_close < dr\_open \end{cases}$$
- IDR (Internal Defining Range): Based on candle bodies (open/close extremes): $$idr\_high = \max_{i}(\max(open_i, close_i)), \quad idr\_low = \min_{i}(\min(open_i, close_i))$$ $$idr\_range = \max(idr\_high - idr\_low, 10^{-9}), \quad idr\_mid = \frac{idr\_high + idr\_low}{2}$$
2. V-Shape 3-Leg Trajectory Encoding
Quantifies the path dynamics within the IB window across 3 directional segments:
$$vs\_leg1 = \frac{extreme_1 - dr\_open}{idr\_range}$$ $$vs\_leg2 = \frac{extreme_2 - extreme_1}{idr\_range}$$ $$vs\_leg3 = \frac{dr\_close - extreme_2}{idr\_range}$$ $$vs\_ix = \frac{\text{bar\_index}(extreme_1)}{N_{bars}}$$ $$vs\_shape = \frac{vs\_leg1 \cdot vs\_leg3}{\max(|vs\_leg2|, 0.01)}$$3. Price Map Clustering (5 Centroids)
Clusters all 48 price levels (open, high, low, close across 12 IB bars) against 5 fixed structural price anchors:
$$C = \{ c_0: dr\_open, \; c_1: dr\_close, \; c_2: idr\_high, \; c_3: idr\_mid, \; c_4: idr\_low \}$$Each level \( p \in \{O, H, L, C\} \) is assigned to the nearest centroid \(\arg\min_j |p - c_j|\):
$$ib\_hl\_concentration = \frac{count(c_2) - count(c_4)}{N_{levels}}$$ $$ib\_oc\_concentration = \frac{count(c_0) - count(c_1)}{N_{levels}}$$ $$ib\_mid\_concentration = \frac{count(c_3)}{N_{levels}}$$ $$ib\_price\_map = \arg\max_j count(c_j)$$4. Expansion Window Timing Indices
Normalized temporal progress \([0.0, 1.0]\) anchored to session boundaries and breakout events:
- Breakout Index: $$br\_ix = \frac{br\_time - post\_ib\_start}{window\_end - post\_ib\_start}$$
- Peak Return Index: $$abr\_ix = \frac{peak\_time - post\_ib\_start}{window\_end - post\_ib\_start}$$
- Before-High/Low-of-Day Index: $$bhlod\_ix = \frac{bhlod\_time - br\_time}{window\_end - br\_time}$$
- After-High/Low-of-Day Index: $$ahlod\_ix = \frac{ahlod\_time - peak\_time}{window\_end - peak\_time}$$
- DR Failure 1 Index: $$dr\_fail\_1\_ix = \frac{fail1\_time - br\_time}{window\_end - br\_time}$$
- DR Failure 2 Index: $$dr\_fail\_2\_ix = \frac{fail2\_time - peak\_time}{window\_end - peak\_time}$$
- ABR0 / ABR2 Indices: $$abr0\_ix = \frac{abr0\_time - post\_ib\_start}{window\_end - post\_ib\_start}, \quad abr2\_ix = \frac{abr2\_time - post\_ib\_start}{window\_end - post\_ib\_start}$$
5. Price Action Model (PAM) 9-Class Classification
| Class | Type | Condition |
|---|---|---|
M2_xxx | No Breakout | \(br = 0\) or \(\text{NaN}\) (No confirmed close outside DR) |
M1_baa | Clean Breakout | Breakout confirmed, BHLOD formed, ABR peak reached, AHLOD formed, no failures |
M1_xaa | Early Peak Breakout | Breakout without prior BHLOD, ABR peak reached, AHLOD formed |
M1_bax | Breakout Trending | BHLOD formed, ongoing new peak (AHLOD not yet set) |
M0_faa | Type 1 Failed Breakout | DR Failure 1 occurred before peak reversal |
M0_xaf | Type 2 Failed Breakout | DR Failure 2 occurred following peak extension without prior BHLOD |
M0_fax | Type 1 Immediate Fail | DR Failure 1 without subsequent AHLOD |
M0_faf | Compound Failure | Both DR Fail 1 and Fail 2 triggered |
M0_baf | Type 2 Failure with BHLOD | BHLOD formed, then post-peak failure |