Universal Direction Estimator

Overview
The Universal Direction Estimator V1 is a Pine Script v6 indicator that unifies Trend, Momentum, and Market-Structure readings into a single normalized score ranging from −1 to +1. It can optionally reference a higher timeframe (HTF) for confirmation and apply a custom Wilder-style ADX confidence boost to highlight conditions where directional bias is statistically stronger.
It’s designed as an interpretable directional meter – providing a quick visual estimate of whether short-term forces favor upward, downward, or neutral movement.
How It Works
The model produces three independent sub-scores each normalized to the −1 to +1 range:
• Trend Component (EMA-Spread): Measures distance between a fast and slow EMA, scaled by ATR and passed through a smooth tanh function to stabilize extremes.
• Momentum Component (ROC): Captures short-term velocity using rate-of-change over a configurable window.
• Structure Component (Market Structure): Detects new highs or lows within a rolling bar window and otherwise uses the deviation of price from a mid-SMA to express bias.
A weighted blend (default = 45 % Trend / 35 % Momentum / 20 % Structure) forms the base score.
Optional modules then refine it:
• HTF Alignment Bonus: When both local and higher-timeframe direction share the same sign, the score receives a small positive adjustment; disagreement slightly reduces confidence.
• ADX Confidence Boost: A self-contained Wilder-style +DI / −DI / DX calculation raises the score’s magnitude when measured trend strength exceeds a user threshold.
• The final bounded result determines one of three discrete states:
UP (score > 0.10), DOWN (score < −0.10), or NEUTRAL (inside the dead-zone).
Visual and Functional Features
• Candle Coloring: Optional shading of bars by current directional state.
• Direction Trail: A smoothed overlay of the score for visual continuity.
• Flip Markers: Up/Down triangles plotted when the estimator changes state.
• Status Table: Compact on-chart panel listing Direction, Score %, individual component weights, ADX value, and HTF alignment flag.
• Alerts: Built-in conditions trigger “Direction Flip: UP” / “Direction Flip: DOWN.”
Why It’s Original
Rather than relying on a single legacy indicator, this tool fuses three orthogonal measures into a unified confidence-weighted direction index, with both adaptive normalization and a bespoke ADX engine that avoids ta.adx(). The method produces a consistent −1 to +1 score applicable across instruments and timeframes, suitable for comparative scanning or overlay visualization.
It’s not a clone of classic moving-average or momentum systems; its novelty lies in the weighted, bounded integration and multi-timeframe coherence adjustment that makes directional interpretation more stable and portable between markets.
Configuration & Usage Notes
• Timeframes: Enter a higher-TF (e.g., 60, 240, D) and enable Use HTF Confirmation to activate cross-timeframe logic.
• Lengths & Weights: Adjust EMA, ROC, and Structure lookbacks and their blend ratios to tune sensitivity.
• Confidence Filter: Modify ADX length and threshold to emphasize stronger trends.
• Visual Controls: Toggle candle colors, trail line, arrows, and status table to fit your chart layout.
This estimator can be paired with other analytical overlays (volume, volatility, structure) for study purposes, but it is not designed to issue automated trade entries or exits.
Legal Disclaimer
This indicator is for charting and educational use only and does not constitute financial advice, trading signals, or performance claims. Markets involve risk, including the loss of principal. Past performance does not guarantee future results. Use at your own discretion and consult a qualified professional before making financial decisions. Provided “as is,” without warranties
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với TradingScriptSolutions.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.
Hướng dẫn của tác giả
Thông báo miễn trừ trách nhiệm
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với TradingScriptSolutions.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.