Regime Composite Score
Deciding whether a market is currently worth trending or fading is usually done by eye. This indicator blends two independent reads of that question into a single trend-quality score, and reports current volatility separately as context rather than folding it into the same number. Kaufman's efficiency ratio measures how much of a window's total price path actually contributed to net movement - a straight line scores close to 1, a market that wandered back over itself scores close to 0. Lag-1 autocorrelation of bar-to-bar returns measures a related but distinct thing: whether a move tends to be followed by another move in the same direction (positive) or a reversal (negative). Averaging the two into one trend axis reduces the chance that either measure's blind spot drives the reading alone - efficiency can be fooled by a slow grind, autocorrelation by short-lived noise. Volatility is tracked as a percentile rank of current short-window volatility against its own trailing history, and is used only to qualify the label - TRENDING/VOLATILE reads differently from a trading plan than TRENDING/QUIET, even though both share the same trend-axis score. House style does not permit the DRAW_COLOR_* line types that would normally paint a continuous coloured chart background for this kind of regime read, so the label lives in a corner panel instead of behind the candles. Notes and limitations - The volatility percentile loop compares the current short-volatility reading against InpVolLookback prior windows computed the same way; a very large InpVolLookback will noticeably slow the first calculation across a long chart history. - Efficiency ratio and autocorrelation are weighted equally with no further calibration - this is a transparent blend, not a fitted model, and the 50/50 split is a starting point worth adjusting per instrument. - The regime label is descriptive, not predictive: TRENDING describes how price has behaved over the lookback windows, not which direction it will continue in. - This does not size a position, place a stop, or account for spread and slippage.
Indicator · MT4 · v1.0 · Free
About Regime Composite Score
Regime Composite Score is an indicator for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 11 settings, such as Er period, Autocorr period and Vol short period. MQL source code included.
Files in the download: RegimeCompositeScore.ex4, RegimeCompositeScore.mq4, RegimeCompositeScore.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Er period | 10 | Kaufman efficiency-ratio period, bars |
| Autocorr period | 20 | Return pairs used for the lag-1 autocorrelation |
| Vol short period | 10 | Bars in the short volatility window |
| Vol lookback | 60 | Prior windows ranked to build the volatility percentile |
| Trend threshold | 65.0 | Score at or above this = trending |
| Choppy threshold | 35.0 | Score at or below this = choppy |
| Corner | CORNER_LEFT_UPPER | Panel corner |
| X distance | 10 | Panel horizontal offset, pixels |
| Y distance | 20 | Panel vertical offset, pixels |
| Font size | 10 | Panel font size |
| Alerts | true | Alert once per closed bar on a regime change |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Oscillator · Trend · Alerts · MT4 Indicator · MQL4 Source Code