Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader.
Idea
LERM classifies every bar into one of five market regimes: bullish/bearish trend, bullish/bearish exhaustion, volatility compression and noise. It combines three measurements:

Trade Renko charts automatically using the advanced Renko Expert Advisors. Clean trends, better entries. Discover them here.
- Fractal Efficiency Ratio (FER): net price move divided by the total path over N bars. 1 = perfectly directional, 0 = pure back-and-forth.
- Compression Pressure: 1 − ATR(short)/ATR(long), clamped to 0..1. High values mean recent volatility is well below its reference level.
- Time-adjusted volume Z-Score: tick volume is compared only with bars from the same time-of-day slot over the previous days, so the normal session cycle (e.g. the London open) does not create false spikes.
Regimes and colors
- Green / Red: bullish / bearish trend (FER above threshold, direction measured over the FER window).
- Blue: exhaustion. Volume spike, long rejection wick, new N-bar extreme. An upper wick means bearish exhaustion, a lower wick bullish.
- Gold: compression (low short-term volatility relative to the long-term one).
- Gray: noise.
The silver line is the FER.
Inputs
- Fractal Efficiency Ratio period: bars used for FER and direction (default 14).
- Short / Long ATR period: volatility windows for compression (7 / 50).
- Volume profile lookback: days of history for the volume profile; on D1 and above, number of bars (25).
- Minimum samples: below this the volume Z-Score is set to 0 (10).
- FER threshold for trend: minimum efficiency for a trend regime (0.42).
- Minimum compression pressure: threshold for the compression regime (0.45).
- Volume filter for compression: ignore volume, require low volume (default) or require high volume, with its Z-Score threshold.
- Volume Z-Score threshold for exhaustion (1.5), Minimum wick/range ratio (0.45), Maximum FER for exhaustion (0.75).
- Exhaustion only at an N-bar extreme: 0 disables the check (10).
- Same weekday only: compare volume only with the same day of the week.
For EA developers
Buffers available via iCustom/CopyBuffer: 3 = Regime_ID (0 noise, ±1 trend, ±2 exhaustion, 5 compression), 4 = volume Z-Score, 5 = compression pressure. Bar 0 uses partial tick volume and repaints: read from shift 1.
The default thresholds are reasonable starting values, not optimized ones. Test them on your own symbol and timeframe.
Build better strategies with RobotFX professional tools – check them out.
79936