Regime analytics · module v2

Relative
Information Density

A single dimensionless number that answers one question before every entry: is this market currently carrying information, or is it just carrying noise?

RID™ ∈ [0, 100]

The master equation

Everything on this page reduces to one ratio. Volatility on top, conviction underneath. When a market moves a great deal without going anywhere, the numerator grows and the denominator does not, and the index climbs.

ρt = At Pt · (Nt + 1)

A = average true range  ·  P = momentum persistence  ·  N = noise factor  ·  t = bar index

The raw ratio ρ has no upper bound and no natural scale. Its magnitude depends on the symbol, the timeframe and the tick size. So it is never read directly. It is measured against its own recent history and re-expressed on a fixed 0 to 100 scale. That scaled value is the RID™ index, and that is what the gate reads.

Orientation

High RID™ → volatile chaos: wide ranges, no directional separation, indecisive momentum. Low RID™ → efficient and persistent: the range the market is producing is actually being spent on going somewhere.

The three measurements

Three standard indicators are computed on the chart's own timeframe and then combined. Nothing exotic, nothing proprietary in the inputs. The work is in the composition.

Average true range

Raw volatility magnitude, in price units. Period 14 by default.

Momentum persistence

The absolute gap between a fast and a slow exponential average, showing how far the short term has actually separated from the long term. 5 against 50.

Noise factor

Distance of the relative strength index from its midpoint. Period 14, midpoint 50.

2.1  Average true range, the numerator

True range is the largest of the three ways a bar can have moved; the average true range is Wilder's smoothing of that series. It is deliberately gap-aware, which is why it is preferred here over a plain high-minus-low.

TRt = max  (  Ht − Lt , |Ht − Ct−1| , |Lt − Ct−1|  ) 

and   At = ATR(14)  =  Wilder smoothing of TR over 14 bars

2.2  Momentum persistence, the first denominator term

Two exponential moving averages of the close, one short and one long, each with the usual smoothing constant α = 2 / (n + 1). Their absolute separation is the measure of persistence: averages only pull apart when moves keep arriving in the same direction.

EMA(n)t = αCt + (1 − α)EMA(n)t−1

then

Pt = max  (  |EMA(5)t − EMA(50)t| , δ  ) 

δ = one point of the symbol, the smallest price increment it quotes

Why the floor matters

When two averages cross, their separation passes through zero. Left alone, ρ would divide by something arbitrarily small and the index would spike to meaningless extremes at exactly the moment the market is quietest. Clamping P at one point keeps the ratio finite while staying faithful to the formula. One point is small enough that it only ever binds when the separation is genuinely negligible.

2.3  Noise factor, the attenuator

The relative strength index sits at 50 when gains and losses balance. Its distance from that midpoint is therefore a measure of directional conviction, and it enters the denominator as N + 1.

RSIt = 100 − 100 1 + RSt ,  RSt = avg gain14 avg loss14

then

Nt = |RSIt − 50| ∈ [0, 50]

The + 1 is not cosmetic. At RSI = 50 exactly, N = 0, and the term collapses to 1, and the denominator falls back to bare persistence rather than vanishing. At the other extreme, N = 50, the attenuation is a factor of 51. So conviction can suppress the index by up to two orders of magnitude, and never amplify it.

The raw index, bar by bar

The ratio is evaluated once for every bar in a trailing window. Bar 1 is the last closed bar; the bar currently forming is index 0 and is deliberately excluded, so the index never changes underneath a decision that is already being made.

ρi = ATR14(i) max(|ΔEMA(i)|, δ) · (|RSI14(i) − 50| + 1)

for  i = 1, 2, …, L   where   L = lookback = 100 bars

3.1  Dimensional sanity

Both A and P are quoted in price units, so they cancel. N is already a pure number. The ratio is therefore dimensionless. It does not care whether the instrument is priced in the hundreds or the hundred-thousandths, which is precisely what allows one index to be compared across symbols once it is normalised.

[ρ] = price price · 1 = 1

Normalisation onto a 0 to 100 scale

The window of raw values is scanned for its extremes, and the current value is expressed as its position between them. This is a min-max rescaling, not a percentile rank: the index reports where the present sits between the calmest and the most chaotic bar of the last hundred, not how many bars it beats.

W = { ρ1, ρ2, …, ρL } ,   m = min W ,   M = max W

and the span of the window is  s = M − m

The index is then defined piecewise, because a window with no span at all has no meaningful position inside it:

RID™ = 50 if s ≤ 0  (a perfectly flat window) RID™ = clamp  (  ρ1 − m s × 100, 0, 100  )  otherwise

the flat case returns dead centre: neutral, neither efficient nor chaotic

4.1  Two properties worth knowing

The scaling is invariant to magnitude. Multiply every raw value in the window by any positive constant and the index is unchanged: the constant cancels out of numerator and denominator alike. Only the shape of the window matters.

RID™(kρ1, kW) = kρ1 − km k(M − m) × 100 = RID™(ρ1, W)

The clamp can never actually fire. The current value is itself a member of the window, so m ≤ ρ1 ≤ M holds by construction and the quotient already lies in [0, 1]. The clamp is there purely as a floating-point guard, a cheap insurance policy against the last bit of a division.

The consequence of a relative scale

Because the reference points move with the window, the index is non-stationary. A reading of 80 means "chaotic compared with the last hundred bars", not "chaotic in absolute terms". Over a long enough stretch of quiet market, the calmest bar available is still assigned 0 and the least calm still reaches 100. The index measures contrast, and contrast always exists.

Work it through

Every term above, live. The first three inputs describe the bar being measured and produce the raw ratio; the next two describe the window it is being measured against: its calmest and its most chaotic bar. Distances are in points, the symbol's smallest increment, so the one-point floor sits at 1 on the second slider.

Measurements

120 pt
80 pt
58.0

The window, W

0.0500
0.4000

Permitted band

0.0
100.0

Relative information density

 

 

In band

The lit region is the permitted band; the marker is the current index.

Intermediate terms of the current calculation
TermValue

The pipeline

From the price series to a single number, in six stages.

The RID calculation pipeline The price series feeds three indicators: average true range, a fast and slow exponential moving average, and the relative strength index. These produce the terms A, P and N. The three terms combine into the raw ratio rho for each bar in the window, and the window is then min-max rescaled into the 0 to 100 index. Price series high, low, close · chart timeframe ATR(14) RID_ATRPeriod EMA(5) · EMA(50) RID_EMAFast / RID_EMASlow RSI(14) RID_RSIPeriod A volatility, price units P = | EMA₅ − EMA₅₀ | then floored at one point N = | RSI − 50 | 0 ≤ N ≤ 50 ρ = A / ( P · (N + 1) ) evaluated for each of the last 100 closed bars RID = ( ρ₁ − min W ) / ( max W − min W ) × 100 W = the 100 raw values · span of zero returns 50 · result clamped to 0 to 100 cached once per bar

Six stages. The only per-tick work is a cache lookup. See section 8.

Where the gate sits

The index does not generate signals. It only ever withholds permission from a signal that has already been produced. A candidate entry has to survive the whole chain below, in order, and the regime gate is the first filter it meets once the position-level checks are done.

Hard controls: drawdown, daily limits, trading window, news blackout
A signal fires, on a bar that has not already been traded
Hedging rules: is an opposite position open, and is it far enough away
Regime gate: is the index inside the permitted band
Trend filter: does the higher-level direction agree
Support and resistance proximity
Gatekeeper: real order, or logged as a virtual trade

The test itself is a closed interval, applied identically to long and short candidates:

entry allowed ⇔ RID™min ≤ RID™ ≤ RID™max

a rejection is written to the log with the value and the band, never silently dropped

It fails open, by design

If the index cannot be computed (indicator handles unavailable, or not yet enough bars of history), the gate returns permission granted rather than blocking every trade. A diagnostic that has gone quiet should not become an accidental kill switch; the other filters in the chain are still doing their jobs. The dashboard shows n/a whenever this is the case, so it is visible rather than silent.

Invariants and edge cases

Every boundary condition is decided in advance. None of them is left to chance.

Edge cases and the behaviour each one produces
ConditionBehaviourWhy
EMA separation below one point Raised to exactly one point Stops a division by a vanishing denominator at a crossover
Window span of zero Index is 50 No contrast exists, so neither extreme can be justified
Fewer bars of history than L + 2 Unavailable, −1 The window must be complete, including the bar behind it
Lookback set below 2 Unavailable, −1 A window of one bar has no minimum and maximum to speak of
An indicator handle failed to open Unavailable, −1 Reported at startup and shown as n/a on the dashboard
Value unavailable and the filter is on Entry permitted Fails open rather than halting all trading
Same bar, a second tick Cached value returned The inputs are closed-bar values, so nothing can have changed
Bar 0, still forming Excluded from the window Keeps the index stable for the duration of a decision
Quotient outside [0, 1] Clamped to the ends Unreachable by construction; retained as a rounding guard

Parameter reference

Nine inputs, all of them yours. The filter ships switched off and the band ships wide open, so nothing about the index changes your results until you decide it should.

The nine regime filter inputs, their defaults and what each one controls
InputDefaultControls
UseRIDFilterfalseWhether the band is enforced at all
RID_ATRPeriod14Averaging period for the volatility term
RID_EMAFast5Fast leg of the persistence measure
RID_EMASlow50Slow leg of the persistence measure
RID_RSIPeriod14Averaging period for the noise factor
RID_Lookback100Bars in the normalisation window
RID_MinToTrade0.0Lower edge of the permitted band
RID_MaxToTrade100.0Upper edge of the permitted band
RID_ShowOnDashboardtrueLive value and band status on the chart panel

9.1  Reading the dashboard line

The chart panel carries the value and the verdict on a single line, so there is never any doubt about what the filter is doing at a given moment.

RID™: 23.4  [IN BAND]

green when the value is inside the band, red when it is blocking, grey when the value is unavailable

9.2  Shaping the band

Example band settings and what each admits
BandAdmits
0 to 100Everything. The index is measured and displayed but never blocks. The shipped default
0 to 40Only the efficient end: ranges being spent on directional movement. Suits trend and breakout logic
60 to 100Only the chaotic end: wide ranges with no separation. Suits mean-reversion logic
25 to 75The middle, avoiding both extremes of the recent window

Before you narrow it

A narrower band means fewer entries. That is the entire point of a filter, and it cuts good trades along with bad ones. The index is relative to its own window and to the symbol and timeframe you run it on, so a band that suits one chart will not automatically suit another. Test any change the way you would test any other change to your strategy, and treat nothing here as a prediction of outcome.

One number. Every entry.

The regime filter is one of nine input groups in the EA. Everything else is documented the same way.

See how the rest works.

This page documents how a calculation inside the Expert Advisor works. It is not financial advice, not a signal, and not a claim that any setting produces a particular outcome. Performance depends entirely on your own strategy, configuration and market conditions. All trading involves risk and you may lose some or all of your capital.