# Methods

## Currency Network Strength

For each available broker-resolved pair, closed-bar log returns are calculated over 1, 5, 20, and 60 bars. Each horizon return is divided by `1.4826 × MAD(one-bar log returns, 126) × sqrt(horizon)`, with a `1e-6` floor. A pair is down-weighted from 1.0 to 0.5 only when its current spread is more than three times its 126-bar median spread.

Each observation is written as `return(pair) = strength(base) - strength(quote)`. Weighted normal equations are solved with one temporary anchor, after which all eight scores are centered so their sum is zero. A connected rank of seven is mandatory. Horizon strengths are combined with weights 20/25/30/25 percent, then cross-sectionally winsorized at median ± three robust standard deviations. Residual RMS becomes `confidence = max(0, 1 - residual_RMS/3)`.

## Portfolio Exposure & Stress

Every open FX position is read without mutation. Base and profit-currency legs are derived from broker symbol metadata and translated into the account currency through broker conversion symbols. Stop risk is the absolute adverse result of `OrderCalcProfit` from current price to SL. No SL is labelled `UNBOUNDED`, never zero.

The four static stress scenarios are USD +1%, USD -1%, chart base +1%, and one mean daily true range adverse with all position co-movement treated conservatively. P/L uses broker contract specifications through `OrderCalcProfit`.

## Economic Event Risk Map

The indicator queries `CalendarValueHistory` from trade-server time minus 24 hours to plus seven days. Events are filtered by the chart's base/profit currencies and minimum importance, grouped by currency and minute, then drawn as zones and labels. A timer refreshes no more often than every 60 seconds. The last successful result remains cached with an explicit stale age when refresh fails. Alerts are off by default and de-duplicated by event ID and threshold.

## Regime Persistence Map

Efficiency ratio and normalized three-state sign entropy are calculated over 20, 50, and 100 closed bars; each metric uses the median of the three windows. Realized volatility is the sample standard deviation of 20 log returns and is ranked against 252 strictly older rolling estimates. Range expansion is median true range over the latest five bars divided by the median of the preceding 60 bars.

`SHOCK` activates when volatility percentile is at least 90 or expansion at least 1.8. Otherwise `TREND` requires efficiency at least 0.35 and entropy at most 0.90; `RANGE` requires efficiency at most 0.20 and entropy at least 0.95; remaining cases are `TRANSITION`. Shock is immediate on one closed bar. Other state changes require two consecutive closed-bar raw states. Bar 0 is explicitly preliminary.
