A professional trading robot that combines a classic Moving Average crossover strategy with an embedded Gaussian Naive Bayes machine learning classifier. 20 market features, real-time filtering, and online retraining — completely free.
FxMath_AICross uses a two-stage decision process: a classic MA crossover triggers the initial signal, and a machine learning model validates it before execution.
Fast EMA(10) crosses Slow EMA(50)
20 market features computed
Naive Bayes predicts profitability
Only if confidence ≥ 55%
Trends, momentum, volatility, price action, volume, HTF context & session time
Works on both MetaTrader 4 and MetaTrader 5
Model retrains every 500 bars to adapt to market regimes
Completely free for clients — no restrictions, no license fees
Fast EMA(10) crosses above Slow EMA(50) = BUY signal. Crosses below = SELL signal. Configurable periods, MA method, and applied price.
Gaussian Naive Bayes evaluates 20 features. Only trades when confidence ≥ 55%. Reduces false signals by ~30–50% in trending markets.
ATR-based dynamic SL/TP, trailing stop (activates at % of TP), max 5 trades/day, max 10% drawdown protection.
Live status display on chart: ML status, signal direction, confidence %, equity, drawdown, ATR and current settings.
Gaussian Naive Bayes classifier trained on 20 carefully selected market features with z-score normalization for stable learning.
Complete parameter reference for configuring FxMath_AICross on both MT4 and MT5.
Best Pair: EURUSD on H1 timeframe. Clean trends, high liquidity, moderate volatility.
Default settings work well: FastMA=10, SlowMA=50, SL=1.0x ATR, TP=2.0x ATR, ML confidence ≥ 55%.
Copy the .ex5 file to MQL5/Experts/. Attach to chart, enable AutoTrading. First run trains the ML on 1000 bars of history.
For MT4: contact us for the compiled .ex4 binary.
1. Look back 1000 bars from startup.
2. For each bar, simulate BUY & SELL with ATR-based SL/TP.
3. Label: BUY if TP hit first, SELL if TP hit first, skip if both SL.
4. Train Gaussian Naive Bayes on labeled 20-feature vectors.
5. Retrain every 500 bars — model adapts to market changes.
FxMath_AICross is a trend-following strategy at its core. Its performance varies significantly by symbol and timeframe. Here is a detailed guide based on the EA's mechanics.
The EA's default settings are optimized for EURUSD on H1. This pair offers the cleanest trend structure, highest liquidity, and moderate ATR (50-80 pips on H1) that matches the default 1:2 SL/TP ratio perfectly. The MA crossover generates reliable signals, and the Naive Bayes filter effectively removes false crossovers in ranging conditions.
| EURUSD | ★ RECOMMENDED | Cleanest trends, tight spreads |
| GBPUSD | Good | Strong directional moves, use SL 0.8x |
| USDJPY | Good | Consistent trends on H1/H4 |
| AUDUSD | Decent | Technical, trends well |
| XAUUSD (Gold) | Avoid | Too volatile, frequent false MA crossovers |
| USDCAD | Caution | Often range-bound, whipsaws |
| NZDUSD | Caution | Lower volatility, more false signals |
| Exotics (USDTRY etc.) | Avoid | Unpredictable, spreads too wide for ML |
| Timeframe | Suitability | Notes | Recommended Settings |
|---|---|---|---|
| M1 / M5 | Not Recommended | Too noisy — MA crossovers fire constantly on minute data. ML model cannot find stable patterns. ATR-based SL/TP is too tight. | — |
| M15 / M30 | Use With Caution | Acceptable if you want more trades, but expect lower win rate. Increase SL to 1.5x and confidence to 60%. | FastMA=8, SlowMA=40, SL=1.5x, TP=2.0x, Conf=0.60 |
| H1 | ★ BEST | Optimal balance of signal quality and trade frequency. H1 bars capture meaningful swing moves. ML retrains every 500 bars (~3 weeks) — stable learning. | FastMA=10, SlowMA=50, SL=1.0x, TP=2.0x, Conf=0.55 (DEFAULT) |
| H4 | Good | Slower, fewer trades but higher quality. Best with wider SL/TP. Retrain interval spans months — very stable. | FastMA=15, SlowMA=75, SL=1.2x, TP=2.5x, Conf=0.60 |
| D1 / W1 | Too Slow | Very few trades per year. Online learning can't keep up — 500 bars on D1 is nearly 2 years. | — |
The EA's MA crossover core is a trend-following strategy. EURUSD on H1 has the cleanest trend structure with fewer whipsaws than other pairs. The 20 ML features (including HTF MA/RSI, ADX, and BB width) are specifically designed to identify trending conditions on hourly data. The default retrain interval of 500 bars on H1 (~3 weeks of trading) gives the model enough data to learn current market behavior without lagging behind regime changes.
Gold is driven by macro news, geopolitical events, and has sharp spike-and-retrace behavior. The MA crossover generates frequent false signals during these events. The Naive Bayes model sees the 20 features change dramatically during spikes but the labels (based on ATR-based SL/TP) become unreliable. The result: the ML filter either blocks too many trades (misses real moves) or lets through too many false ones. Gold requires a more sophisticated model like RFConsensus with multi-TF voting and Q-Learning adaptation.
Both versions share identical strategy logic. Here are the platform-specific differences.
| Feature | MT4 (MQL4) | MT5 (MQL5) |
|---|---|---|
| Platform | MT4 | MT5 |
| Indicator API | Value-returning (iMA, iRSI...) + built-in arrays (Open[], High[]) | Handle-based (iMA returns handle) + CopyBuffer |
| Order System | OrderSend / OrderModify (single-thread) | CTrade class with PositionSelect, PositionModify |
| Strategy Logic | Identical | Identical |
| ML Classifier | Identical Naive Bayes | Identical Naive Bayes |
| 20 Features | Same calculation | Same calculation |
| Chart Panel | Yes | Yes |
| Online Retraining | Yes | Yes |
| Trailing Stop | Yes | Yes |
| Filling Mode Auto-Detect | N/A (MQL4) | Yes |
| Order Filling | Slippage parameter only | FOK / IOC / RETURN auto-detected |
| Recommended TF | H1 | H1 |
| Source Provided | Compiled only | Compiled only |
Need more power? FxMath offers professional-grade EAs with gradient boosting, reinforcement learning, and AI strategy generation — built for traders who demand more.
| Feature | FxMath_AICross | RFConsensus | Lumina |
|---|---|---|---|
| Price | FREE | $99 | $299 |
| AI Engine | Naive Bayes | RF + LGBM + Q-Learning RL | LightGBM Strategy Generator |
| Features | 20 | 28 | 500+ ML features |
| Timeframes | 1 (H1) | 3 (multi-TF voting) | Any (M1–MN) |
| Reinforcement Learning | No | Yes — Q-Learning | Yes — Adaptive |
| Strategy | Fixed MA crossover | AI ensemble consensus | Custom-generated by RR target |
| Walk-Forward Validation | No | Yes | Yes |
| Simultaneous Instances | 1 | 1 per chart | Unlimited |
| Platform | MT5 (MT4 on request) | MT4 + MT5 | MT5 (Python bridge) |
| DLL Required | No | RF: No / LGBM: Yes | Yes (static) |
Completely free for clients — no registration, no license key, no restrictions. Both source code and compiled binaries included.
Compiled binary (.ex5) — ready to use, no compilation needed
Binary: 72 KB • Drag & drop to MQL5/Experts/
Compiled binary (.ex4) — ready to use, no compilation needed
MT4 version available on request • Message us on Telegram
"This EA is provided free of charge with no restrictions. You may use it on live accounts, demo accounts, or backtest it. No license key, no expiration, no hidden fees."— FxMath Financial Solution
Need a custom or more advanced EA? Explore FxMath Lumina (AI Strategy Generator, $299) or FxMath RFConsensus (Dual AI Engines + RL, $99). Or just ask us anything!
Need a tailored solution? Advanced EAs, indicators, or ML-based strategies?
Contact us for custom projects
Upgrade to Lumina (AI strategy generator) or RFConsensus (dual AI engines + RL)