● FREE for Clients — No Restrictions

AI-Powered MA Crossover
Expert Advisor

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.

MT4 MT5 ● 20 Features ● Naive Bayes ● Online Learning
▲ BUY EURUSD H1 AI 20 Features → NB Classifier → Trade

How It Works

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.

1

MA Crossover

Fast EMA(10) crosses Slow EMA(50)

2

Feature Extraction

20 market features computed

3

ML Prediction

Naive Bayes predicts profitability

4

Trade Execution

Only if confidence ≥ 55%

20

Market Features

Trends, momentum, volatility, price action, volume, HTF context & session time

2

Platforms

Works on both MetaTrader 4 and MetaTrader 5

500

Online Retrain

Model retrains every 500 bars to adapt to market regimes

0

Cost

Completely free for clients — no restrictions, no license fees

📈

MA Crossover Core

Fast EMA(10) crosses above Slow EMA(50) = BUY signal. Crosses below = SELL signal. Configurable periods, MA method, and applied price.

🤖

ML Filter

Gaussian Naive Bayes evaluates 20 features. Only trades when confidence ≥ 55%. Reduces false signals by ~30–50% in trending markets.

Risk Management

ATR-based dynamic SL/TP, trailing stop (activates at % of TP), max 5 trades/day, max 10% drawdown protection.

📊

Chart Panel

Live status display on chart: ML status, signal direction, confidence %, equity, drawdown, ATR and current settings.

Machine Learning Architecture

Gaussian Naive Bayes classifier trained on 20 carefully selected market features with z-score normalization for stable learning.

INPUT FEATURES (20) GAUSSIAN NAIVE BAYES CLASSIFIER P(Class | Features) = P(Class) × ∏ P(Feature₁ | Class) Z-score normalization • Log-probability • Softmax confidence ▲ BUY Probability Score ▼ SELL Probability Score BUY 72.3% SELL 27.7% 55% threshold Only trade when confidence ≥ threshold

20 Input Features

TREND MA Fast Slope
TREND MA Slow Slope
TREND MA Cross Distance
TREND HTF MA Trend
MOM RSI Value
MOM RSI Slope
MOM Stochastic %K
MOM Stochastic %D
VOL ATR Ratio
VOL BB Width
PA Candle Body %
PA Upper Wick %
PA Lower Wick %
PA Close Position
PA Prev Body %
VOL Volume Ratio
TREND HTF RSI
TREND ADX
TIME Session Hour
PA BB Position

Full Documentation

Complete parameter reference for configuring FxMath_AICross on both MT4 and MT5.

💡 Recommended Setup

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%.

⚙ Installation

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.

Moving Averages
Fast MA Period10
Slow MA Period50
MA MethodEMA
Applied PriceClose
SL/TP & ATR
ATR Period14
SL Multiplier1.0 × ATR
TP Multiplier2.0 × ATR
Trailing50% / 10%
Trade & Risk
Lot Size0.10
Magic Number123456
Max Daily Trades5
Max Drawdown10%
Slippage50 pt
ML Indicators
RSI Period14
HTF TimeframeH1
HTF MA Period50
BB Period / Dev20 / 2.0
Stochastic (K/D/Slow)14 / 3 / 3
ADX Period14
Online Learning
Train Bars1000
Forward Bars (label)5
Max Train Samples2000
Min Confidence55%
Retrain Every500 bars
Min New Samples50
How Training Works

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.

Best Pairs & Timeframes

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.

✅ Recommended: EURUSD H1

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.

▲ Best Pairs

EURUSD★ RECOMMENDEDCleanest trends, tight spreads
GBPUSDGoodStrong directional moves, use SL 0.8x
USDJPYGoodConsistent trends on H1/H4
AUDUSDDecentTechnical, trends well

▼ Pairs to AVOID

XAUUSD (Gold)AvoidToo volatile, frequent false MA crossovers
USDCADCautionOften range-bound, whipsaws
NZDUSDCautionLower volatility, more false signals
Exotics (USDTRY etc.)AvoidUnpredictable, spreads too wide for ML
Timeframe Suitability Notes Recommended Settings
M1 / M5Not RecommendedToo noisy — MA crossovers fire constantly on minute data. ML model cannot find stable patterns. ATR-based SL/TP is too tight.
M15 / M30Use With CautionAcceptable 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★ BESTOptimal 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)
H4GoodSlower, 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 / W1Too SlowVery few trades per year. Online learning can't keep up — 500 bars on D1 is nearly 2 years.

🔬 Why EURUSD H1 Works Best

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.

⚠ Why Gold (XAUUSD) Fails

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.

MQL4 vs MQL5

Both versions share identical strategy logic. Here are the platform-specific differences.

Feature MT4 (MQL4) MT5 (MQL5)
PlatformMT4MT5
Indicator APIValue-returning (iMA, iRSI...) + built-in arrays (Open[], High[])Handle-based (iMA returns handle) + CopyBuffer
Order SystemOrderSend / OrderModify (single-thread)CTrade class with PositionSelect, PositionModify
Strategy LogicIdenticalIdentical
ML ClassifierIdentical Naive BayesIdentical Naive Bayes
20 FeaturesSame calculationSame calculation
Chart PanelYesYes
Online RetrainingYesYes
Trailing StopYesYes
Filling Mode Auto-DetectN/A (MQL4)Yes
Order FillingSlippage parameter onlyFOK / IOC / RETURN auto-detected
Recommended TFH1H1
Source ProvidedCompiled onlyCompiled only

Advanced Paid EAs

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
PriceFREE$99$299
AI EngineNaive BayesRF + LGBM + Q-Learning RLLightGBM Strategy Generator
Features2028500+ ML features
Timeframes1 (H1)3 (multi-TF voting)Any (M1–MN)
Reinforcement LearningNoYes — Q-LearningYes — Adaptive
StrategyFixed MA crossoverAI ensemble consensusCustom-generated by RR target
Walk-Forward ValidationNoYesYes
Simultaneous Instances11 per chartUnlimited
PlatformMT5 (MT4 on request)MT4 + MT5MT5 (Python bridge)
DLL RequiredNoRF: No / LGBM: YesYes (static)

FxMath Lumina

AI Strategy Generator — $299 lifetime

Lumina is an autonomous ML trading terminal. You don't code strategy rules — you set your ideal Risk/Reward ratio and profit target, and Lumina generates a complete machine-learned strategy around your preferences.

✓ AI Strategy Generator ✓ RR-Adaptive Learning ✓ Pair & TF Validator ✓ Walk-Forward Backtester ✓ Unlimited Instances ✓ Any TF (M1–MN) ✓ LightGBM Engine ✓ MT5 Python Bridge
Learn More →

Why Lumina is More Advanced

  • AICross uses a fixed MA crossover with a Naive Bayes filter — it enhances a single strategy.
  • Lumina generates a completely custom strategy from your RR target — it learns the market patterns, not just filters signals.
  • ▶ Uses LightGBM gradient boosting (not simple Naive Bayes) — significantly higher predictive accuracy on the same data.
  • Walk-Forward backtester validates on out-of-sample data before you trade live — eliminates curve-fitting risk.
  • ▶ Runs on any timeframe from M1 to MN1 — not limited to H1.
  • Unlimited simultaneous instances on different pairs/TFs — true multi-market automation.
⚠ AICross is a free entry-level EA. Lumina is institutional-grade.

FxMath RFConsensus

Two AI Engines in One Package — $99 lifetime

RFConsensus is the first EA to offer two AI engines in one package: a pure-MQL Random Forest (no DLLs) and a LightGBM + Q-Learning version with reinforcement learning that adapts trading thresholds based on every trade outcome.

✓ RF (Pure MQL) + LGBM+RL ✓ 28 Technical Features ✓ Multi-TF Voting (3 TFs) ✓ Q-Learning RL Agent ✓ MT4 + MT5 Included ✓ Volatility-Adaptive Labels ✓ Q-Table Persistence ✓ Any Symbol & TF
Learn More →

Why RFConsensus is More Advanced

  • AICross uses a single Naive Bayes model on one timeframe.
  • RFConsensus uses 3 independent ML models across 3 timeframes with confidence-weighted voting — much stronger signal filtering.
  • 28 features (vs. 20) including skew, kurtosis, Elder-Ray, CMO, and volume analysis.
  • ▶ The Q-Learning RL agent learns from every trade and adapts thresholds in real time — AICross has no reinforcement learning.
  • ▶ RF version is pure MQL, zero DLLs — works on any broker with no setup.
  • LGBM+RL version adds gradient boosting + Q-table persistence across sessions.
⚠ AICross = 1 model × 1 TF. RFConsensus = 6 models × 3 TFs + RL.

Download Free

Completely free for clients — no registration, no license key, no restrictions. Both source code and compiled binaries included.

MT5

FxMath_AICross for MT5

Compiled binary (.ex5) — ready to use, no compilation needed

↓ Download .ex5

Binary: 72 KB • Drag & drop to MQL5/Experts/

MT4

FxMath_AICross for MT4

Compiled binary (.ex4) — ready to use, no compilation needed

Contact us for .ex4

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

Get In Touch

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!

💬

Telegram

Join the community for updates & support

t.me/FxMath

Email

Click to copy to clipboard

fxmathsolution@gmail.com
💻

Custom Development

Need a tailored solution? Advanced EAs, indicators, or ML-based strategies?

Contact us for custom projects

🔮

Advanced EAs

Upgrade to Lumina (AI strategy generator) or RFConsensus (dual AI engines + RL)

Visit lumina.fxmath.comrfconsensus.fxmath.com