Loading…

Regime Filtered Signal Overlay

"Only trade this signal when the market is trending" is common advice, but it is rarely checked with an actual number. This overlay plots a Close-vs-SMA cross signal twice on the same chart: small grey arrows for every cross, and larger coloured arrows for the subset that fired while ADX(InpAdxPeriod) was above InpAdxThreshold at that bar - the regime filter. Both sets are visible together so it is obvious which crosses the filter discards, not just how many are left. The historical hit rate for each set - the percentage of crosses whose price moved in the expected direction over the next InpLookaheadBars bars - is computed separately and printed as an on-chart comment, along with the plain percentage-point difference between them. A filter that looks sensible but produces a smaller or unchanged hit rate on the actual instrument being charted is a genuinely useful negative result, and this tool reports that outcome exactly as honestly as a positive one. ADX above a fixed threshold is a well-understood, ordinary regime definition, used here deliberately rather than a novel one - the point of this tool is measuring the effect of a regime filter, not inventing a new way to define a regime. Notes and limitations - Non-repainting: arrows are placed on confirmed crosses using completed bar values, and ADX is read at that same confirmed bar. - The hit-rate table only scores crosses old enough that InpLookaheadBars have already elapsed, so the most recent signals near the current bar are correctly excluded until their outcome is known. - The regime definition (ADX above a fixed threshold) is a common, simple one; a different regime definition (volatility-based, session-based, etc.) would need its own comparison logic, not a parameter change here. - The Close-vs-SMA cross is a placeholder base rule; the side-by-side filtered/unfiltered comparison and hit-rate scoring applies to any directional signal.

Indicator · MT5 · v1.0 · Free

About Regime Filtered Signal Overlay

Regime Filtered Signal Overlay is an indicator for MetaTrader 5 based on Moving Average and ADX. It draws buy and sell arrows on the chart. It has 5 settings, such as Ma period, Adx period and Adx threshold. MQL source code included.

Files in the download: RegimeFilteredSignals.ex5, RegimeFilteredSignals.mq5, RegimeFilteredSignals.txt.

Settings

SettingDefaultWhat it does
Ma period20SMA period the base rule crosses against
Adx period14ADX period used as the regime filter
Adx threshold25.0ADX must be above this to count as "trending"
Lookahead bars10Bars ahead used to score hit-rate for each set
Stats lookback bars3000How many recent bars are scanned to build the hit-rate table

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · ADX · Buy/Sell Arrows · Trend · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria