Market Regime Detector
- Indicators
-
Mohamed Amr Mohamed Osama Abdelwahab
Software Developer, Instructor, and Technical Team Leader with over 22 years of experience across desktop, web, and financial software development. Top Rated freelancer on Upwork with 200+ completed projects, $200K+ delivered, and a 100% job success record. Specialized in algorithmic trading systems - Version: 1.10
MORE TOOLS
All my indicators, Expert Advisors and utilities are listed here:
Market Regime Detector - Know Which Kind Of Market You Are In
A breakout method loses money in a range. A mean reversion method loses money in a trend. Neither method is broken; they are simply being used in the wrong conditions. Market Regime Detector names the current conditions so you can decide whether your approach fits them.
Three independent measurements are combined into one label, and the label only changes when the new state has held for long enough to be believed.
THE THREE MEASUREMENTS
Direction. ADX for trend strength, plus the relationship between a fast and a slow moving average and the separation between them expressed in ATR, so that the same threshold behaves sensibly on a quiet currency pair and on a volatile index.
Efficiency. The ratio of net movement to the total distance price actually travelled over the lookback. A value near one means a straight, purposeful move; a value near zero means the market covered a lot of ground and arrived nowhere.
Volatility. Current ATR against its own long average. This is a ratio rather than an absolute figure, which is what makes it comparable across instruments.
THE SEVEN STATES
STRONG TREND UP and STRONG TREND DOWN. Directional and efficient. Continuation methods suit these conditions.
WEAK TREND UP and WEAK TREND DOWN. There is a drift but it lacks conviction. Reduced size is a reasonable response.
RANGE. Not enough strength or efficiency to call it a trend. Fading the edges suits this better than trading breakouts.
VOLATILE. Expansion without direction. Stops need room, or the market needs to be left alone.
QUIET. Compression. Often precedes expansion, which makes it a poor time to force a trade and a good time to prepare.
THE CONFIRMATION FILTER
A raw classification changes constantly on live data, which makes it useless for decisions. Here a candidate state must repeat for a configurable number of bars before it replaces the accepted one. The label you read has therefore already proved it is stable.
MAIN INPUTS
ADX period, fast and slow moving average periods, ATR period, ATR baseline period and efficiency lookback. Thresholds for strong and weak ADX, minimum efficiency for a trend, and the ATR ratios that define volatile and quiet. Number of bars required to confirm a regime change. Panel with corner, offsets and font size. Optional colour strip on the chart showing the current regime at a glance. Separate colours for uptrend, downtrend, range, volatile and quiet. Alert on regime change with popup, sound and push notification.
TRADING IDEAS
Use it as a switch rather than a signal. Turn a breakout approach off in RANGE and a fading approach off in STRONG TREND, instead of trying to make one method work everywhere.
Treat QUIET as preparation time. Compression tends to resolve into expansion, so it is a reasonable moment to mark levels rather than to enter.
In VOLATILE conditions, consider whether your usual stop distance is still appropriate. The same stop that was sensible last week may now sit inside ordinary noise.
Compare the regime label with your own results. If your losses cluster in one regime, that is a filter you can apply rather than a flaw in your method.
Watch the efficiency reading on its own. A market can have a high ADX and still be inefficient, which usually means the trend is choppy enough to stop you out on the way to being right.
COMPATIBILITY
Works on any symbol and any timeframe. Analysis only: this indicator never sends, modifies or closes an order. The regime code, ADX, efficiency and volatility ratio are published to indicator buffers so an Expert Advisor or another indicator can read them.
