OPEN-SOURCE SCRIPT
تم تحديثه

Trend Strength Meter [AGPro Series]

813
Trend Strength Meter [AGPro Series]

⚡ OVERVIEW

Trend Strength Meter is a multi-factor composite oscillator that quantifies how strong a directional trend actually is, on a single 0-to-100 score. It merges five independent trend dimensions (ADX, slope angle, momentum ROC, moving-average alignment, and pullback depth) into one weighted reading, then classifies the market into three clear states: Strong Trend (80+), Mild Trend (50-80), and Weak / Range (<50). The goal is to give a trader the answer to one of the most common daily questions in technical analysis: "Is the trend strong enough to act on right now, or is it fading?"

The indicator is built for discretionary and systematic traders who want a single, normalized number instead of reading half a dozen separate trend tools. It is scale-invariant (ATR-normalized) and works across timeframes and instruments.


🎯 UNIQUE EDGE

Trend-strength tools usually give a single-factor reading (for example, ADX alone) which can be misleading. ADX can be high during range contractions, slopes can spike during noise, MA stacks can be aligned while price sits deep in pullback. This indicator fuses all five dimensions so that no single factor can dominate the score without confirmation from the others.

Three design choices set it apart:

1. Weighted multi-factor composite. Every factor is independently normalized to 0-100, then combined with user-adjustable weights that auto-normalize. A Strong reading therefore requires broad agreement across independent trend dimensions, not just one signal firing.

2. Dominant Factor readout. The information panel shows which of the five factors is contributing most to the current score, so the trader understands why the score is where it is. A score of 84 driven by ADX and a score of 84 driven by Alignment are structurally different markets, and the readout makes that visible.

3. Historical context built in. The panel exposes Historical Max Score over a configurable lookback window, and Strong-Trend Duration (how many bars the score has held above the Strong threshold). Both of these help gauge trend maturity and exhaustion risk.


📊 METHODOLOGY

The composite score is built from five independently scored factors, each normalized to 0-100:

• Factor 1 — ADX. Directional movement strength from the standard DMI/ADX system, linearly mapped so that ADX = 60 maps to a score of 100.

• Factor 2 — Slope Angle. The slope of an EMA over its length window, normalized by ATR to be scale-invariant, then converted to a 0-100 score via an arctangent curve. High slope in either direction yields a high score.

• Factor 3 — Momentum ROC. Rate of Change normalized by ATR and converted to a bounded 0-100 value. Captures impulse magnitude independent of price scale.

• Factor 4 — MA Alignment. Stacked EMA alignment across Fast / Mid / Slow timeframes, plus price position relative to the fast MA. Full bullish or bearish stack yields 100; partial stacks are scored proportionally (70, 40, or 15).

• Factor 5 — Pullback Depth. Distance from the nearest recent extreme (highest high or lowest low over lookback) measured in ATR units. Shallow pullback = strong trend = high score.

Each factor is multiplied by its weight, summed, and divided by total weight to produce the final 0-100 score. All five weights are independently adjustable and auto-normalize, so changing one weight does not force manual rebalancing of the others.

Directional bias (Bull / Bear / Range) is determined by the combination of DMI crossover state and close-vs-mid-MA position. State color shifts between strong bull green, strong bear magenta, neutral yellow, and weak gray based on score plus direction.


🔥 VISUAL SYSTEM

Six coordinated visual elements deliver the information without clutter:

• Score histogram on the sub-panel, colored per bar by that bar's own score level (green for Strong, yellow for Mild, gray for Weak / Range). Each historical bar shows its true state at the time, not the current state.

• Horizontal reference lines at the Strong (green) and Mild (yellow) thresholds on the sub-panel.

• Historical Max step line in indigo accent, showing the highest score reached within the lookback window, so past trend peaks are immediately visible.

• Mini Gauge on the right edge of the sub-panel. A compact vertical meter split into two halves: left half shows the fixed 0-100 zone reference (Weak / Mild / Strong), right half fills up to the current score, with a bold needle line marking the exact level.

• Price badge floating above the last candle, showing "TSM [score] [state]" so the reading is visible without needing to look at the panel.

• Information panel on the price chart with seven rows: Score, State, Direction, Dominant Factor, Historical Max, and Strong Bars duration.


🧭 SIGNALS AND ALERTS

Three built-in alerts:

• Strong Bull Entry — Score crosses above the Strong threshold while directional bias is Bull.
• Strong Bear Entry — Score crosses above the Strong threshold while directional bias is Bear.
• Trend Fade — Score drops below the Mild threshold, indicating the trend is weakening.

All alerts fire once per bar close, so there is no intra-bar repainting.


🧮 KEY INPUTS

Core Settings
• ADX Length, Slope MA Length, Momentum ROC Length, MA Alignment Fast / Mid / Slow, Pullback ATR Length
• Score Smoothing (EMA applied to score for optional overlay line)
• Strong Threshold (default 80), Mild Threshold (default 50), Historical Lookback (default 100 bars)

Factor Weights (auto-normalized)
• ADX 30, Slope 20, Momentum 20, Alignment 20, Pullback 10

Visual
• Badge toggle, Background tint toggle, Reference lines toggle, Mini Gauge toggle, Historical Max line toggle, Smoothed Score line toggle, Label size, Badge ATR offset

Panel
• Show / hide, Position (6 anchors), Theme (Dark / Light), Font size


📈 HOW TO USE

1. Add the indicator to any chart and any timeframe. Defaults are calibrated for 4H / Daily; for lower timeframes consider reducing the ADX and ROC lengths.

2. Use the 0-100 score as a regime filter. Many trend-following setups perform better when the score is above 50, and breakout / continuation setups perform best when the score is crossing above 80 with a clear Bull or Bear direction.

3. Watch the Dominant Factor. A score of 85 driven primarily by Momentum may fade fast; the same score driven by Alignment tends to be more structural.

4. Use Historical Max and Strong Bars to gauge maturity. A Strong-Bars reading of 30+ on a daily chart often signals late-cycle conditions where continuation risk increases and fresh entries need tighter risk management.

5. Combine with structure tools (support / resistance, order blocks, market-structure tools) for entries. This indicator is designed to answer "how strong is the trend," not "where do I enter."


⚠️ LIMITATIONS AND TRANSPARENCY

• This is an indicator, not a trading strategy. It does not produce buy / sell recommendations and it does not backtest trade outcomes.
• The score is a lagging composite built from historical price data. It does not predict future price movement.
• During sharp regime transitions (news events, gap opens), the score can change rapidly from one bar to the next. This is by design, not a bug.
• Factor weights are user-adjustable. Defaults are a reasonable starting point but may need tuning per instrument / timeframe.
• The Pullback factor assumes trending behavior. In tight consolidations it can read misleadingly high, which is why the Dominant Factor readout exists as a cross-check.
• No-repaint: all calculations are based on confirmed (closed) bar data; alerts fire on bar close only.


📌 RISK DISCLOSURE

Trading carries substantial risk. This indicator is an analytical tool for research and study purposes and does not constitute financial advice, a trading signal, or a recommendation to buy or sell any instrument. Past behavior of any indicator is not indicative of future results. Users are solely responsible for their trading decisions and should conduct their own due diligence and risk management.
ملاحظات الأخبار
🔧 UPDATE NOTES - 1.6

This update focuses on factor-strip spacing, dashboard clarity, and sub-panel visual hierarchy.

The core purpose of the script remains unchanged.
This release improves how the existing trend-strength score is presented, organized, and interpreted on the chart.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Refined Factor Contribution Strip spacing.
The factor labels and bars now have more vertical breathing room for cleaner reading across timeframes.

• Adjusted factor-row proportions.
The strip bars are slightly slimmer and more separated, reducing label crowding around the right edge.

• Preserved the Factor Contribution Strip.
ADX, slope, momentum, alignment, and pullback components remain visible as compact contribution bars.

• Preserved the cleaner right-edge gauge and smoothed score line.
The raw histogram remains visible, while the score line and gauge continue to support first-glance interpretation.

• Preserved expanded panel controls.
Panel locations, Elite Dark, Slate, Clean Light themes, Huge font sizing, and live position updates remain available.


------------------------
Visual Improvements
------------------------

• Improved factor-strip readability

• Reduced label crowding around the right edge

• Refined the histogram, score-line, gauge, and factor-strip relationship

• Improved panel consistency with the AGPro dashboard style

• Kept threshold lines, historical max, and strong-trend tint available for context


------------------------
Interface & Usability
------------------------

• Added Middle Center panel placement support

• Added Slate panel theme while preserving dark and light options

• Added table.set_position support for live panel-location updates

• Preserved the single merged blue AG Pro panel header row

• Kept Normal as the default label and panel font-size setting


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

The ADX, slope, momentum, moving-average alignment, pullback-depth scoring, weighted composite score, trend classification, and alerts remain aligned with the previous release.

The goal is to improve clarity and usability, not to introduce new predictive behavior.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Trend strength can vary across timeframes, volatility regimes, and market structure conditions.

Outputs should always be interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.