OPEN-SOURCE SCRIPT

EDGE ATLAS

92
WHAT IS EDGE ATLAS?

EDGE ATLAS is a multi-factor market environment scanner. It does not generate buy or sell signals. Instead, it answers a more fundamental question that most traders skip entirely: "Is this a good environment to trade right now — and if so, what type of strategy fits these conditions?"

The indicator fuses four independent market dimensions into a single composite EDGE Score (0–100), assigns a letter grade (A through F), classifies the current regime (TREND, RANGE, or NEUTRAL), determines directional bias, and recommends a strategy type — all displayed in a compact, repositionable HUD overlay.

Most indicators measure one thing. A moving average measures trend. Bollinger Bands measure volatility. Volume indicators measure participation. Each one gives you a single dimension of a multi-dimensional problem. EDGE ATLAS combines all four dimensions simultaneously so you can see the full picture before committing capital.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

THE SCORING MODEL — HOW THE EDGE SCORE IS CALCULATED

The EDGE Score is a weighted composite of four independent measurements. Each component is normalized to a 0–1 scale before weighting, ensuring that no single dimension can dominate the final score regardless of instrument or timeframe.


COMPONENT 1 — PLAY EDGE (45% of total score)

This is the largest component because it answers the most important question: is there a strong, tradeable pattern right now?

The indicator calculates two separate edge measurements and takes the larger of the two:

Play Edge = max(Trend Strength, Range Fade Edge)

This dual-path design means the score remains high whenever ANY strong play exists — whether the market is trending cleanly or sitting at a mean-reversion extreme.

Trend Strength is itself a three-factor composite:

Trend Strength = 0.45 x Efficiency Ratio + 0.35 x ADX (normalized) + 0.20 x Slope Magnitude

- Efficiency Ratio (Kaufman): Measures directional efficiency of price movement over N bars. A value of 1.0 means price moved in a perfectly straight line. A value near 0 means price went nowhere despite lots of bar-to-bar movement. This is the core chop filter.

- ADX (normalized): The classic Wilder Average Directional Index, normalized to a 0–1 scale where ADX below 15 maps to 0 and ADX above 35 maps to 1. Measures the strength of any directional movement regardless of direction.

- Slope Magnitude: The absolute slope of the Anchor EMA, normalized by ATR. This captures how aggressively the trend center-of-gravity is moving. A flat EMA produces 0. A steeply angled EMA produces values approaching 1.

Range Fade Edge measures mean-reversion opportunity:

Range Fade Edge = (1 - Trend Strength) x Deviation Edge

Deviation Edge activates when price deviates from the Anchor EMA by more than the ATR deviation threshold (default: 0.90 ATR). The further price stretches beyond that threshold, the higher the Range Fade Edge becomes — but only when Trend Strength is LOW. This prevents the indicator from suggesting mean-reversion trades during a strong trend.

WHY THREE SUB-FACTORS FOR TREND?
Using a single trend indicator creates fragility. ADX can stay high during volatile chop. Efficiency Ratio can briefly spike during a single large candle. EMA slope can lag during fast reversals. By combining all three with different weights, the Trend Strength reading becomes robust against the failure mode of any single measurement. When all three agree, you have genuine trend conviction. When they diverge, the score drops — which is exactly what should happen in ambiguous conditions.


COMPONENT 2 — VOLATILITY QUALITY (20% of total score)

Not all volatility is equal. This component measures whether current volatility is in a "tradeable" range by comparing the current ATR against a long-run ATR baseline (100-period EMA of ATR by default).

The scoring curve works as follows:
- ATR is 70%–160% of baseline: Score = 1.0 (normal, healthy volatility)
- ATR is below 70% of baseline: Score decreases linearly (compressed, pre-breakout — unpredictable)
- ATR is above 160% of baseline: Score decreases inversely (expanded, chaotic — hard to manage risk)

This reflects a practical reality: compressed volatility often precedes explosive moves where stops get blown, and extreme volatility makes position sizing and stop placement unreliable. The best trading environments have active but not extreme price movement.


COMPONENT 3 — PARTICIPATION (20% of total score)

Current volume divided by its moving average, clamped to a 0–1 scale. A ratio of 2.0 (double the average volume) maps to a perfect score of 1.0. Average volume maps to 0.5. Below-average volume maps below 0.5.

Higher participation means the current price action is backed by real market activity rather than thin-market noise. Breakouts on high volume are more likely to follow through. Trends on declining volume are more likely to fail. This component captures that dynamic.

NO-VOLUME HANDLING: On instruments where volume data is unavailable (forex pairs, some indices, certain data feeds), this component automatically defaults to a neutral 0.5 score and the HUD displays "N/A" in the Participation row. This prevents false score inflation or deflation on symbols where volume simply does not exist.


COMPONENT 4 — MEAN PROXIMITY (15% of total score)

Calculated as:

Mean Proximity = 1 / (1 + |deviation from EMA in ATR units|)

This produces a smooth decay curve: price sitting exactly on the EMA scores 1.0. Price one ATR away scores 0.5. Price two ATRs away scores 0.33. And so on.

This component serves a specific purpose within TREND regimes: it rewards entries that are close to the trend's center of gravity (the EMA) where risk/reward is most favorable, rather than entries at extended prices where a pullback is statistically overdue.

Note that this component has the LOWEST weight (15%) by design, and it works in counterbalance with the Range Fade Edge in the Play Edge component. When price is far from the EMA, Mean Proximity decreases — but if the regime is RANGE, Range Fade Edge increases. The two effects partially offset each other, which is intentional. The net result is that the total score captures whether the current distance from the mean represents opportunity (range fade) or risk (overextended trend entry).


FINAL SCORE ASSEMBLY:

EDGE Score = 100 x (0.45 x Play Edge + 0.20 x Volatility Quality + 0.20 x Participation + 0.15 x Mean Proximity)

The result is an integer from 0 to 100. Higher is better. The score does not predict direction — it measures environment quality.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

GRADING SCALE

A (score 80 or above) — Exceptional environment. Multiple dimensions are aligned. High conviction.
B (score 65–79) — Good environment. Most dimensions are favorable. Standard risk is appropriate.
C (score 50–64) — Marginal. Some dimensions are favorable but others are not. Reduce exposure or be very selective.
D (score 35–49) — Poor. Most dimensions are unfavorable. The odds are not in your favor.
F (score below 35) — No detectable edge. Conditions are choppy, illiquid, or chaotic. The recommended action is to do nothing.

All grade thresholds are adjustable in settings to match your personal risk tolerance.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

REGIME CLASSIFICATION

The TrendScore (the Trend Strength component described above) is compared against two thresholds to classify the market into one of three regimes:

TREND — TrendScore exceeds the upper threshold (default: 0.65). Price is moving efficiently in one direction with confirming momentum. The indicator assigns directional bias by following the slope of the Anchor EMA: upward slope = LONG bias, downward slope = SHORT bias.

RANGE — TrendScore falls below the lower threshold (default: 0.35). Price movement is choppy and non-directional. The indicator assigns directional bias ONLY when price has deviated beyond the ATR deviation threshold from the Anchor EMA, and the bias points BACK toward the EMA (mean reversion). If price is ranging but near the EMA, no bias is assigned because there is no mean-reversion edge yet.

NEUTRAL — TrendScore is between the two thresholds. The market is in transition — potentially shifting from trend to range or vice versa. No directional bias is assigned. The recommended action is to wait for clarity.

The gap between the TREND and RANGE thresholds creates a deliberate dead zone. This is a feature, not a limitation. Markets spend significant time in transitional states where neither trend-following nor mean-reversion strategies perform well. The NEUTRAL classification prevents the indicator from forcing a read on ambiguous conditions.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

STRATEGY RECOMMENDATIONS

Based on the current grade and regime, the HUD displays one of six strategy suggestions:

A or B + TREND + LONG bias : MOMENTUM LONG — Conditions favor trend-following on the long side
A or B + TREND + SHORT bias : MOMENTUM SHORT — Conditions favor trend-following on the short side
A or B + RANGE + LONG bias : MEAN REV LONG — Conditions favor buying the dip back toward the mean
A or B + RANGE + SHORT bias : MEAN REV SHORT — Conditions favor selling the rally back toward the mean
A or B + no bias : WAIT FOR BIAS — Environment is good but no directional edge yet
C grade : REDUCE SIZE — Marginal conditions; if you trade, trade small
D or F grade : SIT OUT — Conditions do not support any strategy type

These recommendations tell you WHAT TYPE of strategy fits the current environment. They do not tell you WHERE to enter, where to place stops, or when to exit. Those decisions remain yours. The value of EDGE ATLAS is in filtering out the environments where your strategies are statistically unlikely to perform, regardless of how good the individual setup looks.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

THE HUD DASHBOARD

The overlay table displays eight rows of information organized into two tiers:

PRIMARY (what to act on):
Header row — Score (0–100) and letter grade, color-coded from green (A) to red (F)
Regime — TREND / RANGE / NEUTRAL with regime-appropriate background color
Bias — Directional arrow (up/down) or dash for no bias
Play — The specific directional play in plain language
Strategy — Actionable recommendation with color-coded background

TRANSPARENCY (why the score is what it is):
Trend — TrendScore sub-component (0.00 to 1.00)
Vol Q — Volatility Quality sub-component (0.00 to 1.00)
Partic — Participation sub-component (0.00 to 1.00, or N/A if volume unavailable)

The transparency tier is what makes EDGE ATLAS a learning tool, not a black box. When the score drops from B to D, you can immediately see which dimension degraded. Did the trend weaken? Did volume dry up? Did volatility spike to abnormal levels? This feedback loop teaches you to read market structure over time, not just follow a number.

HUD customization:
- Repositionable to any of 6 screen positions (all four corners plus middle-left and middle-right)
- Three text sizes (Tiny, Small, Normal) to fit any monitor and chart layout
- Fully toggleable — hide the HUD entirely if you prefer only the background tint or badge


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ADDITIONAL VISUAL FEATURES

Background Tint — A subtle color wash behind candles reflecting the current regime and bias. Green tones for bullish trend, red tones for bearish trend, blue tones for range with long bias, orange tones for range with short bias, neutral gray for no bias. This gives you instant visual context without adding any lines or shapes to the chart. Toggleable in settings.

Candle Tint — Colors candles by directional bias. Off by default to keep charts clean. Enable it when you want bias direction visible at a glance without reading the HUD.

Last-Bar Badge — A floating label positioned on the most recent bar showing the grade, regime, direction arrow, and score in a compact format. Automatically positions above candles for long bias, below candles for short bias. Toggleable.

Anchor EMA — The EMA line used internally for all regime and deviation calculations. Hidden by default because the indicator's value is in the composite analysis, not the moving average itself. Enable it if you want to visually confirm where the "center of gravity" sits.

Data Window Output — The raw EDGE Score is exposed as a plot in TradingView's Data Window. This means other Pine scripts can reference it as a source input, enabling you to build strategies or additional indicators that use the EDGE Score as a filter.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ALERTS

Seven built-in alert conditions cover all major state changes:

Regime Change — Fires when the market shifts between TREND, RANGE, and NEUTRAL
Trend Long — New momentum long setup detected (regime shifted to TREND with upward bias)
Trend Short — New momentum short setup detected (regime shifted to TREND with downward bias)
Fade Long — New mean-reversion long setup detected (RANGE regime, price stretched below mean)
Fade Short — New mean-reversion short setup detected (RANGE regime, price stretched above mean)
Upgraded to A — Score crossed above the A-grade threshold
Grade Below C — Score dropped below the C-grade threshold (risk-off warning)


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

SETTINGS REFERENCE

Core Settings:
- Source: Price source for calculations. Default is close. HL2 or HLC3 reduces noise on volatile instruments.
- Anchor EMA Length (default 50): The central moving average used for regime detection, slope measurement, and deviation calculation. Use shorter values (20–30) for day trading, 50 for swing trading, 100+ for position trading.
- ATR Length (default 14): Standard Wilder ATR period. Normalizes all measurements so the indicator works identically across instruments with different price magnitudes.
- Volume MA Length (default 20): Baseline for the participation ratio. Current volume is compared against this moving average.

Regime Detection:
- Efficiency Ratio Length (default 20): Lookback for the Kaufman ER. Shorter values react faster to regime changes but produce more noise.
- ADX Length (default 14): Wilder ADX smoothing period. Higher values produce a more stable reading.
- ATR Baseline Length (default 100): Long-run volatility reference for the Volatility Quality component.
- TREND Threshold (default 0.65): TrendScore must exceed this to classify as TREND. Raise for stricter detection.
- RANGE Threshold (default 0.35): TrendScore must fall below this to classify as RANGE. Lower for stricter detection.
- Deviation Threshold (default 0.90 ATR): Minimum distance from the EMA before range bias activates. Raise to only fade extreme deviations.

Grading Scale:
- A/B/C thresholds are fully adjustable. The D threshold is fixed at 35. Below 35 is always F.

Visual Settings:
- Toggle each visual element independently (HUD, background, candles, badge, EMA)
- Reposition HUD to 6 screen locations
- Scale HUD text across 3 sizes


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

HOW TO USE THIS — PRACTICAL WORKFLOWS

For Beginners:
1. Add EDGE ATLAS to your chart.
2. Look at the grade. If it says A or B, the market is in a good state for trading. If it says D or F, close the chart and come back later. This single habit will eliminate a large percentage of losing trades that come from forcing setups in hostile environments.
3. Read the Strategy row. It will tell you whether to look for momentum (trend-following) or mean-reversion (fade) setups, and in which direction. Do not look for momentum setups when it says MEAN REV, and do not try to pick tops/bottoms when it says MOMENTUM.

For Intermediate Traders:
1. Use the regime classification to match your strategy type. If you have a breakout strategy, only deploy it during TREND regimes. If you have a support/resistance bounce strategy, only deploy it during RANGE regimes. Track your win rate in each regime separately — the difference will be significant.
2. Use the sub-scores as early warning. When the Trend sub-score starts declining from 0.80 toward 0.50, the trend is weakening BEFORE the regime officially shifts. This gives you time to tighten stops or take partial profits.
3. Set alerts for grade changes. An "Upgraded to A" alert on your watchlist symbols tells you where the best environments are forming. A "Grade Below C" alert on open positions warns you that conditions are deteriorating.

For Advanced / Quantitative Traders:
1. Reference the EDGE Score from the Data Window as a source input in your own strategies. Use it as a position-sizing multiplier: full size on A-grade, half size on C-grade, flat on F-grade.
2. Backtest your existing strategy with and without the regime filter. Run your entries only when EDGE ATLAS shows the matching regime (TREND entries only in TREND, mean-reversion entries only in RANGE) and compare the equity curve.
3. Examine the individual sub-scores to build more granular filters. For example, you might find that your specific strategy performs best when Trend > 0.70 AND Participation > 0.60, regardless of the other components.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

IMPORTANT DISCLAIMERS

- This indicator does NOT repaint. All calculations use confirmed bar data. No future data is referenced.
- This is NOT a signal generator. It does not tell you when to buy or sell. It tells you whether the current environment supports trading and what type of strategy is appropriate. Entry and exit decisions remain entirely yours.
- Works on all instruments (stocks, forex, crypto, futures, indices) and all timeframes. Automatically adapts to instruments without volume data.
- The scoring weights (45/20/20/15) are derived from established quantitative principles and are not curve-fitted to any specific market, symbol, or time period.
- Past performance of any scoring system does not guarantee future results. Always use proper risk management regardless of the indicated grade.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.