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.
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.
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.
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.
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.
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.
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.
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:
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.
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
The window, W
Permitted band
Relative information density
In band
The lit region is the permitted band; the marker is the current index.
| Term | Value |
|---|
The pipeline
From the price series to a single number, in six stages.
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.
The test itself is a closed interval, applied identically to long and short candidates:
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.
| Condition | Behaviour | Why |
|---|---|---|
| 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.
| Input | Default | Controls |
|---|---|---|
UseRIDFilter | false | Whether the band is enforced at all |
RID_ATRPeriod | 14 | Averaging period for the volatility term |
RID_EMAFast | 5 | Fast leg of the persistence measure |
RID_EMASlow | 50 | Slow leg of the persistence measure |
RID_RSIPeriod | 14 | Averaging period for the noise factor |
RID_Lookback | 100 | Bars in the normalisation window |
RID_MinToTrade | 0.0 | Lower edge of the permitted band |
RID_MaxToTrade | 100.0 | Upper edge of the permitted band |
RID_ShowOnDashboard | true | Live 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
| Band | Admits |
|---|---|
0 to 100 | Everything. The index is measured and displayed but never blocks. The shipped default |
0 to 40 | Only the efficient end: ranges being spent on directional movement. Suits trend and breakout logic |
60 to 100 | Only the chaotic end: wide ranges with no separation. Suits mean-reversion logic |
25 to 75 | The 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.