A complete walkthrough from loading your MT5 data to injecting an AI-powered entry filter into your StratForge EA โ all in your browser, no code required.
Follow these steps in order. The whole process takes about 5โ10 minutes depending on your dataset size.
Export a CSV from MetaTrader 5's History Center and drop it into the trainer. The file should contain Date, Open, High, Low, Close, and Volume columns โ tab or comma separated.
How to export from MT5: Tools โ History Center โ select Symbol + Timeframe โ Export as CSV
| Date | Open | High | Low | Close | Volume |
|---|---|---|---|---|---|
| 2026.01.02 00:01 | 2649.64 | 2649.91 | 2647.82 | 2649.43 | 1585 |
| 2026.01.02 00:02 | 2649.46 | 2649.89 | 2647.86 | 2647.95 | 676 |
| 2026.01.02 00:03 | 2648.88 | 2649.62 | 2647.86 | 2648.87 | 651 |
| โฆ 71,058 rows total | |||||
Choose which technical indicators the AI will use as inputs. Then configure the neural network architecture โ or leave everything at the defaults, which work well for most cases.
Click Start Training. TensorFlow.js runs the training entirely in your browser using WebGL GPU acceleration. Watch the loss curve and accuracy update in real time. Early stopping automatically ends training when the model stops improving.
Typical training time: 1โ5 minutes for 70,000 bars on M1. Larger datasets take longer.
Once training completes, click Download .onnx to save your trained model. Place the file in your MT5 MQL5/Files/ folder before compiling your EA.
sfm5_ai_model.onnx in MT5/MQL5/Files/ before compiling your EA. Requires MT5 Build 3370+.
Set your Confidence Threshold and Filter Mode, then click Send Config to StratForge MT5. Open StratForge โ an AI Signal banner will appear in Step 4. Enable it, complete the wizard, and generate your EA.
New to the trainer? Use this sample XAUUSD M1 file (500 bars) to try the full pipeline before using your own data.
500 bars of synthetic XAUUSD M1 data in MT5 tab-separated format. Ready to load directly into AI Trainer Step 1.
Here's an example of the AI signal module automatically generated and injected into your StratForge EA.
//+------------------------------------------------------------------+ //| StratForge AI Signal Module | //| Generated by FX Strategy Analyzer โ AI Signal Trainer | //| Model : MLP(11โ64โ32โ3) activation=relu | //| Output : 0=Sell 1=NoPos 2=Buy (argmax of softmax output) | //| Place sfm5_ai_model.onnx in: MT5/MQL5/Files/ | //+------------------------------------------------------------------+ #property strict //--- ONNX model handle static long g_onnx = INVALID_HANDLE; static string g_onnxFile = "sfm5_ai_model.onnx"; //--- Indicator handles (auto-generated for selected features) static int h_ma20 = iMA(_Symbol, PERIOD_CURRENT, 20, 0, MODE_SMA, PRICE_CLOSE); static int h_ma50 = iMA(_Symbol, PERIOD_CURRENT, 50, 0, MODE_SMA, PRICE_CLOSE); static int h_ema12 = iMA(_Symbol, PERIOD_CURRENT, 12, 0, MODE_EMA, PRICE_CLOSE); static int h_ema26 = iMA(_Symbol, PERIOD_CURRENT, 26, 0, MODE_EMA, PRICE_CLOSE); static int h_atr14 = iATR(_Symbol, PERIOD_CURRENT, 14); static int h_bb = iBands(_Symbol, PERIOD_CURRENT, 20, 0, 2.0, PRICE_CLOSE); static int h_rsi = iRSI(_Symbol, PERIOD_CURRENT, 14, PRICE_CLOSE); static int h_macd = iMACD(_Symbol, PERIOD_CURRENT, 12, 26, 9, PRICE_CLOSE); //--- Normalization constants (embedded from training data) static const double AI_MEAN[11] = { 0.0000204396f, 0.0000534032f, 0.0000118204f, ... }; static const double AI_STD[11] = { 0.0014719889f, 0.0023922237f, 0.0009442181f, ... }; //+------------------------------------------------------------------+ //| Initialize AI module โ call in OnInit() | //+------------------------------------------------------------------+ bool AI_Init() { h_ma20 = iMA(_Symbol, PERIOD_CURRENT, 20, 0, MODE_SMA, PRICE_CLOSE); if(h_ma20 == INVALID_HANDLE){ Print("AI_Init: h_ma20 failed"); return false; } // ... (all indicator handles initialized) g_onnx = OnnxLoad(g_onnxFile, ONNX_DEFAULT); if(g_onnx == INVALID_HANDLE) { Print("AI_Init: cannot load '", g_onnxFile, "' โ place in MQL5/Files/"); return false; } ulong inSh[] = {1, 11}, outSh[] = {1, 3}; OnnxSetInputShape(g_onnx, 0, inSh); OnnxSetOutputShape(g_onnx, 0, outSh); Print("AI model loaded OK (11 features)"); return true; } //+------------------------------------------------------------------+ //| Returns: 2=Buy 1=NoPos 0=Sell -1=Error | //+------------------------------------------------------------------+ int CheckAISignal(double &conf) { if(g_onnx == INVALID_HANDLE) return -1; double raw[11]; // Compute features from indicator values... { double v = CopyBuf1(h_ma20, 1); raw[0] = (v > 0) ? (rates[1].close - v) / rates[1].close : 0; } // ... (all 11 features computed) float feat[11]; for(int i = 0; i < 11; i++) feat[i] = (float)((raw[i] - AI_MEAN[i]) / AI_STD[i]); float out[3]; OnnxRun(g_onnx, ONNX_NO_CONVERSION, feat, out); int cls = 0; if(out[1] > out[cls]) cls = 1; if(out[2] > out[cls]) cls = 2; conf = (double)out[cls]; return cls; } //--- Entry guard in your StratForge EA (confidence >= 0.55) // Buy: { double c=0; if(CheckAISignal(c)!=2 || c<0.55) return(0); } // Sell: { double c=0; if(CheckAISignal(c)!=0 || c<0.55) return(0); }
Common questions about AI Signal Trainer.
Launch AI Signal Trainer and follow the 5 steps above. Free, private, and browser-only.
๐ Launch AI Trainer Free โ