LERM - Liquidity and Efficiency Regime Matrix
Info
The LERM - Liquidity and Efficiency Regime Matrix is a Indicator for MetaTrader 5 that lerm classifies every bar into one of five market regimes: bullish/bearish trend, bullish/bearish exhaustion, volatility compression, and noise. It combines three measurements:Fractal Efficiency Ratio (FER): net price move divided by the total path over N bars.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Indicators folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use LERM - Liquidity and Efficiency Regime Matrix
1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.
2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.
3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.
4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.
Frequently Asked Questions
Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."
Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).
Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.
What this tool does
LERM classifies every bar into one of five market regimes: bullish/bearish trend, bullish/bearish exhaustion, volatility compression, and noise.
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.
Description & Settings
Related: Spread and Liquidity Clock: Time-of-Day Cost-to-Range Profile - another powerful indicator for MetaTrader 5 traders.
LERM classifies every bar into one of five market regimes: bullish/bearish trend, bullish/bearish exhaustion, volatility compression, and noise. It combines three measurements:Also recommended: Gold Session Liquidity Free MT5 - XAUUSD Sessions, Sweeps, and Risk Planner - similar indicator with strong performance on MetaTrader 5.
Fractal Efficiency Ratio (FER)
: net price move divided by the total path over N bars. A value of 1 indicates a perfectly directional move, while 0 indicates a pure back-and-forth movement.
Compression Pressure
: calculated as 1 minus the ratio of the short-term Average True Range (ATR) to the long-term ATR, clamped to a range of 0 to 1. High values signify that recent volatility is significantly lower than its reference level.
Time-adjusted volume Z-Score
: This metric compares tick volume against bars from the same time-of-day slot over previous days. This approach prevents the typical session cycle (e.g., the London open) from generating false spikes.
Regimes and Colors
Green / Red: Represents bullish / bearish trend regimes. This classification occurs when the FER is above a defined threshold and the direction is measured over the FER window.
Blue: Indicates an exhaustion regime. This is characterized by a volume spike, a long wick rejection, or a new N-bar extreme. An upper wick signifies bearish exhaustion, while a lower wick signifies bullish exhaustion.
Gold: Denotes a compression regime, identified by low short-term volatility relative to the long-term volatility.
Gray: Represents a noise regime.
The silver line displayed on the chart represents the FER.
Inputs
Fractal Efficiency Ratio period
: The number of bars used for calculating FER and direction (default is 14).
Short / Long ATR period
: The lookback periods for the volatility windows used in the compression calculation (default is 7 for short and 50 for long).
Volume profile lookback
: The number of days of history used for the volume profile calculation. For Daily (D1) charts and above, this is measured in the number of bars (default is 25).
Minimum samples
: The minimum number of samples required for the volume Z-Score calculation. If this minimum is not met, the volume Z-Score is set to 0 (default is 10).
FER threshold for trend
: The minimum FER value required to classify a regime as a trend (default is 0.42).
Minimum compression pressure
: The minimum compression pressure value required to classify a regime as compression (default is 0.45).
Volume filter for compression
: This input allows configuration of the volume filter for the compression regime. Options include ignoring volume, requiring low volume (default), or requiring high volume with its corresponding Z-Score threshold.
Volume Z-Score threshold for exhaustion
: The Z-Score threshold for identifying exhaustion based on volume (default is 1.5).
Minimum wick/range ratio
: The minimum ratio between the wick and the range required for an exhaustion signal (default is 0.45).
Maximum FER for exhaustion
: The maximum FER value allowed when identifying an exhaustion regime (default is 0.75).
Exhaustion only at an N-bar extreme
: This setting determines if exhaustion signals are only considered valid when they occur at an N-bar extreme. A value of 0 disables this check (default is 10).
Same weekday only
: When enabled, the volume Z-Score comparison is restricted to the same day of the week.
For EA Developers
The following buffers are available for use with iCustom/CopyBuffer functions:
- Buffer 3: Regime_ID (0 for noise, ±1 for trend, ±2 for exhaustion, 5 for compression).
- Buffer 4: volume Z-Score.
- Buffer 5: compression pressure.
Note that Bar 0 uses partial tick volume and may repaint. It is recommended to read data starting from shift 1.
The default thresholds provided are reasonable starting points and have not been optimized. It is advised to test these settings on your specific symbol and timeframe.
You may also like: Smart Liquidity Hunter: MT5 Indicator for Confirmed Swing Sweeps - excellent alternative for indicator users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.20"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_plots 2
#property indicator_label1 "LERM Regime"
#property indicator_type1 DRAW_COLOR_HISTOGRAM
#property indicator_color1 clrDimGray, clrGoldenrod, clrLimeGreen, clrCrimson, clrDodgerBlue
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.