Regime Lab

  • Kütüphaneler
  • Shipra Gupta
    Shipra Gupta
    Ben Shipra Gupta, matematik, ekonomi ve algoritmik işlem sistemleri konusunda güçlü bir altyapıya sahip trader ve kantitatif strateji geliştiricisiyim. Yıllar boyunca forex, altın, endeksler, emtialar ve kripto para piyasalarında aktif olarak çalıştım ve tutarlılık, hassasiyet ve disiplinli işlem
  • Sürüm: 1.0

RegimeLab – Hidden Markov Model & Market Regime Detection

Most EAs fail because they run the right logic in the wrong regime. RegimeLab tells your EA which regime it is in, using published statistics instead of another moving average.

Features

  • Hidden Markov Model – 2-state Gaussian HMM fitted by Baum-Welch: probability of the turbulent state, state means, volatilities, persistence and expected duration.
  • Hurst exponent – Rescaled-range estimate on any symbol/timeframe or on your own array.
  • Variance ratio z-test – Lo-MacKinlay heteroskedasticity-robust test of momentum vs mean reversion.
  • Efficiency ratio – Kaufman path efficiency from 0 (noise) to 1 (straight line).
  • Volatility percentile – Current Wilder ATR ranked against its own history.
  • Composite label – TREND_UP, TREND_DOWN, MEAN_REVERT, RANDOM or HIGH_VOL in one call.

Quick start

1. Buy and download the library. MetaTrader installs it to MQL5\Libraries\RegimeLab.ex5.
2. Paste the import block below at the top of your EA, indicator or script.
3. Call the functions.

void OnTick()
  {
   int r=RL_Regime(_Symbol,PERIOD_H1,500,1,0.70,1.96);
   if(r==RL_REGIME_HIGH_VOL) return;                 // stand aside
   if(r==RL_REGIME_TREND_UP || r==RL_REGIME_TREND_DOWN) RunTrend(r);
   if(r==RL_REGIME_MEAN_REVERT) RunMeanRevert();
  }

Import block (copy into your code)

#define RL_OK            0
#define RL_ERR_PARAM     1
#define RL_ERR_DATA      2
#define RL_ERR_SYMBOL    3
#define RL_ERR_FIT       4
#define RL_REGIME_UNKNOWN      0
#define RL_REGIME_TREND_UP     1
#define RL_REGIME_TREND_DOWN   2
#define RL_REGIME_MEAN_REVERT  3
#define RL_REGIME_RANDOM       4
#define RL_REGIME_HIGH_VOL     5

#import "RegimeLab.ex5"
int RL_LastError();
double RL_Hurst(const string symbol,const ENUM_TIMEFRAMES tf,const int bars,const int shift);
double RL_HurstArray(const double &series[],const bool is_price);
bool RL_VarianceRatio(const string symbol,const ENUM_TIMEFRAMES tf,const int bars,const int q, const int shift,double &vr,double &z);
double RL_EfficiencyRatio(const string symbol,const ENUM_TIMEFRAMES tf,const int period,const int shift);
double RL_VolPercentile(const string symbol,const ENUM_TIMEFRAMES tf,const int atr_period, const int lookback,const int shift);
double RL_HMMFit(const string symbol,const ENUM_TIMEFRAMES tf,const int bars,const int shift, const int max_iter);
bool RL_HMMParams(const int state,double &mean,double &stdev,double &stay_prob);
double RL_HMMExpectedDuration(const int state);
double RL_HMMLogLikelihood();
int RL_Regime(const string symbol,const ENUM_TIMEFRAMES tf,const int bars,const int shift, const double hivol_prob,const double z_crit);
string RL_RegimeName(const int regime);
#import

Notes

  • Uses completed bars (shift ≥ 1): no repaint, no look-ahead.
  • 64 to 20,000 bars per call; bounded for optimisation.
  • Any symbol and timeframe, so multi-symbol and multi-timeframe filters fit in one EA.

Technical

  • Pure MQL5. No DLL, no WebRequest, no file I/O.
  • Every exported function validates its inputs. RL_LastError() returns the reason for any failed call.
  • Works in the Strategy Tester and live, on any broker, symbol and account currency.

Past performance shown in screenshots is from historical data and does not guarantee future results.

Yazarın diğer ürünleri
AMD Po3
Shipra Gupta
AMD Po3 for MetaTrader 5 Accumulation, manipulation, distribution: mapped for you. AMD Po3 is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator maps the reaction zones that matter right now: the nearest areas above and
KN Smart TP SL Signals — EMA Kesişimi + Akıllı TP/SL KN Smart TP SL Signals , MetaTrader 5 için geliştirilmiş sade bir EMA kesişim göstergesidir ve her onaylanmış kesişimi eksiksiz bir görsel işlem setup'ına dönüştürür: Entry → Stop Loss → TP1 → TP2 → TP3 Manuel seviye hesaplamasına gerek yoktur. Temel Mantık Hızlı EMA, Yavaş EMA'nın üzerine çıkar → Alış Hızlı EMA, Yavaş EMA'nın altına iner → Satış Sinyaller kapanmış mumlarda onaylanır ve böylece halen oluşmakta olan mumdan kaynaklanan sinyalle
IFVG Sniper Entry Engine — MQL5 Pazaryeri Açıklaması IFVG Sniper Entry Engine, Smart Money Concepts (İçsel Piyasa Yapısı) modelindeki en spesifik ve yüksek olasılıklı giriş stratejilerinden biri olan Ters Adil Değer Boşluğu (Inverse Fair Value Gap, IFVG) etrafında tasarlanmış yüksek hassasiyetli bir MT5 indikatörüdür. Grafik üzerinde oluşan her ham Adil Değer Boşluğunu (FVG) arka planda sessizce takip eder, her birini tersine dönme (inversion/mitigation) yönünden izler ve kriterlere uyan bir IFV
Coppock Curve MultiFilter for MetaTrader 5 The classic Coppock curve with modern filters. Coppock Curve MultiFilter is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with
FREE
Tension Flow Trend — Tarihsel RR Backtestli Dinamik HMA Şeridi Tension Flow Trend, Hull Hareketli Ortalaması (HMA) trend şeridini, Z-Score momentum analizini ve yerleşik bir görsel Risk:Ödül (Risk:Reward) backtest motorunu tek bir grafik arayüzünde birleştiren, MetaTrader 5 için geliştirilmiş gelişmiş bir trend takip indikatörüdür. Yüksek olasılıklı trend devam fırsatlarını belirlemek için tasarlanan indikatör, bir işlem kurulumu oluşturmadan önce hem eğim onaylı bir HMA kesişimi hem de yapıland
FREE
Adaptive RSI Supertrend for MetaTrader 5 Trend and RSI momentum in one view. Adaptive RSI Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
FREE
Trend Target Ribbon [BOSWaves] Trend Target Ribbon [BOSWaves] , MetaTrader 5 (MQL5) için geliştirilmiş gelişmiş ve çok yönlü bir trend takip ve risk yönetimi göstergesidir. Pürüzsüzleştirilmiş Arnaud Legoux Moving Average (ALMA) çekirdeğini volatilite ve eğim tabanlı doğrulama filtreleriyle birleştirerek piyasa trendlerini, renk kodlu dinamik ribbon'ları ve otomatik çok seviyeli Risk-to-Reward ($R$) işlem projeksiyonlarını gösterir. Temel Özellikler 1. ALMA Trend Ribbon ve Eğim Filtreleme ALMA S
FREE
Structure-Anchored VWAP [WAT] Structure-Anchored VWAP [WAT] , MetaTrader 5 için piyasa yapısını dikkate alan bir VWAP göstergesidir. VWAP'ı yalnızca sabit seans sıfırlamalarına bağlamak yerine, anlamlı swing ve yapısal noktalara sabitler. Piyasa Yapısı + Anchored VWAP + Sapma Bantları + Retest Sinyalleri + ATR Tabanlı İşlem Yönetimi özelliklerini tek bir görsel yapı altında birleştirir. Temel Özellikler 3 Çapa Modu — Swing, Structure ve Fast Yapı Tespiti — HH, HL, LH, LL, EQH ve EQL Anchor
FREE
Liquidity Intelligence System — MQL5 Pazaryeri Açıklaması Liquidity Intelligence System, Smart Money likidite havuzlarını haritalandıran, likidite alımı ve dönüş (sweep-and-reverse) kurulumlarını tespit eden ve 16 bağımsız test edilebilir sinyal modeli aracılığıyla yüksek uyumlulukta (confluence) işlem sinyalleri üreten kurumsal düzeyde bir MT5 indikatörüdür — hepsi tek bir sade indikatör içinde sunulmuştur. Nasıl Çalışır? Motor; Eşit Tepeler (EQH) ve Eşit Dipler (EQL) dahil olmak üzere, pivot t
Precision Sniper Trader Precision Sniper Trader; Forex, Altın, Endeksler ve Kripto piyasalarında sade grafik görünümü, yüksek olasılıklı girişler ve yapılandırılmış işlem yönetimi isteyen yatırımcılar için tasarlanmış profesyonel bir trend takip ve momentum onay indikatörüdür. Keskin nişancı (sniper) tarzı bir yaklaşımla geliştirilen indikatör; yatırımcıların grafik gürültüsünü ve gereksiz karmaşayı azaltarak güçlü piyasa fırsatlarını tespit etmelerine yardımcı olmak için EMA trend analizini, mo
FREE
TrendIQ Pro for MetaTrader 5 Adaptive volatility trend with a trend cloud. TrendIQ Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull colour for long
SQUEEZE MOMENTUM BREAKOUT MT5 İNDİKATÖRÜ MetaTrader 5 İçin Profesyonel Volatilite Sıkışması ve Momentum Kırılımı Ticaret Sistemi Squeeze Momentum Breakout, düşük volatiliteli konsolidasyon dönemlerinden sonraki patlayıcı piyasa hareketlerini tespit etmek için tasarlanmış profesyonel düzeyde bir MT5 kırılım (breakout) indikatörüdür. Scalper'lar, gün içi (intraday) trader'lar ve momentum trader'ları için geliştirilen bu indikatör; volatilite sıkışmasını, momentum onayını, hacim filtrelemesini ve y
FREE
VOLUME BREAKOUT PRO MT5 İNDİKATÖRÜ MetaTrader 5 İçin Profesyonel Hacim Genişlemesi ve Kırılım Ticaret Sistemi Volume Breakout Pro, MetaTrader 5 platformu için özel olarak geliştirilmiş kurumsal düzeyde (institutional-grade) bir kırılım trading indikatörüdür. Scalper'lar, gün içi (intraday) trader'lar ve momentum kırılım trader'ları için tasarlanan bu sistem, anormal hacim genişlemesi ve likidite dengesizliğinin yönlendirdiği patlayıcı fiyat hareketlerini tespit etmeye odaklanır. İndikatör şu öze
FREE
Meridian Flow — MT5 için Smart Money Structure Göstergesi Meridian Flow, Smart Money Concepts (SMC) ve ICT Price Action metodolojisini kullanan traderlar için geliştirilmiş bir MetaTrader 5 göstergesidir. Her sembol ve zaman diliminde BOS (Break of Structure) ve CHoCH (Change of Character) olaylarını otomatik olarak tespit eder ve her sinyal için Entry, Stop Loss, TP1, TP2 ve TP3 seviyelerini içeren eksiksiz bir risk haritası oluşturur. Buna geçmiş sinyaller de dahildir. Sinyaller yalnızca doğr
Adaptive Trend System for MetaTrader 5 A trend line that adapts to volatility. Adaptive Trend System is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
Market Path Forecast for MetaTrader 5 Projected price paths from swing statistics. Market Path Forecast is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how price b
FREE
RSI Signal Entries for MetaTrader 5 RSI extremes plus candle confirmation. RSI Signal Entries is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with clear extreme zones.
FREE
Trident Swing Projector for MetaTrader 5 Quarter-swing projections from ABC structures. Trident Swing Projector is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how
Z-Score Range Boxes Breakout for MetaTrader 5 Statistical extremes boxed, breakouts flagged. Z-Score Range Boxes Breakout is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator tracks the range or channel price is tradin
Precision Sniper Pro for MetaTrader 5 Four pillars: EMA, RSI, MACD and ADX. Precision Sniper Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator watches for its signal condition and waits for the candle to close b
FREE
Stealth Trail Supertrend for MetaTrader 5 A supertrend that adapts its own multiplier. Stealth Trail Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the tre
Fibonacci Path Profile for MetaTrader 5 How price moved after similar retracements. Fibonacci Path Profile is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how pric
Strong Fade Signals for MetaTrader 5 Fade the overextended move, with a score. Strong Fade Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator watches for its signal condition and waits for the candle to close
FREE
Fan Principle Signals for MetaTrader 5 The classic fan principle, as clear signals. Fan Principle Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and tracks how price
McGinley Dynamic Fusion for MetaTrader 5 McGinley Dynamic crossovers with ATR levels. McGinley Dynamic Fusion is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend
Liquidity Entry Signals for MetaTrader 5 Entries where liquidity gets taken. Liquidity Entry Signals is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator maps the reaction zones that matter right now: the nearest areas
Cardwell Range Pro for MetaTrader 5 RSI ranges that change with the market regime. Cardwell Range Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator plots its oscillator in a separate subwindow with clear extreme
Adaptive RSI Supertrend for MetaTrader 5 Trend and RSI momentum in one view. Adaptive RSI Supertrend is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator draws one trend line that changes colour with the trend: bull co
Market Structure Target Tracker for MetaTrader 5 Swings, BOS, CHoCH and ATR targets. Market Structure Target Tracker is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator detects confirmed swing highs and lows and track
Smart TrendFlow Pro for MetaTrader 5 Channel breaks with a volatility heatmap. Smart TrendFlow Pro is a MetaTrader 5 indicator built for traders who want clear, rule-based chart reading without clutter. It focuses on one job and does it visibly on your chart, so you can make decisions faster and with more confidence. It works on gold (XAUUSD), forex, indices and crypto, on any timeframe from M5 to D1. How it works The indicator tracks the range or channel price is trading in and highlights per
Filtrele:
Değerlendirme yok
Değerlendirmeye yanıt