๐Ÿค– AI Signal Trainer โ€” How to Use

Train Your Own
AI Signal Filter

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.

Step-by-Step Guide

5 Steps to Your AI-Powered EA

Follow these steps in order. The whole process takes about 5โ€“10 minutes depending on your dataset size.

1

Load Your MT5 OHLCV Data

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

Step 1 โ€” Load Data
๐Ÿ“‚
Drop MT5 CSV here or click to browse
Supports tab-separated and comma-separated formats
DateOpenHighLowCloseVolume
2026.01.02 00:012649.642649.912647.822649.431585
2026.01.02 00:022649.462649.892647.862647.95676
2026.01.02 00:032648.882649.622647.862648.87651
โ€ฆ 71,058 rows total
2

Select Features & Configure the Network

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.

Step 2 โ€” Features & Architecture
Select Features
MA 20 MA 50 EMA 12 EMA 26 ATR 14 BB Position RSI 14 MACD MACD Signal Close-Open High-Low/ATR Stochastic K CCI 20 ROC 10 Volume Ratio
Network Architecture
+6
Input
11 features
โ†’
+59
Layer 1
64 neurons
โ†’
+29
Layer 2
32 neurons
โ†’
Output
Buy/Hold/Sell
3

Train the Model

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.

Step 3 โ€” Training
Train Samples
71,058
Features
11
Epoch
23
Val Accuracy
52.7%
Epoch 23/100 ยท val_acc=52.7%
Samples: 71058 ยท Features: 11
Train: 56846 ยท Val: 14212
Arch: 11โ†’64โ†’32โ†’3 relu drop=0.3 lr=0.001
ep=20 loss=0.7040 vl=0.7026 vacc=51.4%
ep=23 loss=0.6991 vl=0.6978 vacc=52.7% โ† best
4

Export as ONNX

Once training completes, click Download .onnx to save your trained model. Place the file in your MT5 MQL5/Files/ folder before compiling your EA.

Step 4 โ€” Export ONNX
๐Ÿง 
sfm5_ai_model.onnx
MLP(11โ†’64โ†’32โ†’3) ยท opset 12 ยท 12.0 KB ยท Accuracy 52.7%
โฌ‡ Download
โš  Place sfm5_ai_model.onnx in MT5/MQL5/Files/ before compiling your EA. Requires MT5 Build 3370+.
5

Inject into StratForge MT5

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.

Step 5 โ€” MQ5 + StratForge Integration
๐Ÿค– AI Signal Model Detected
MLP(11โ†’64โ†’32โ†’3) ยท Accuracy: 52.7% ยท F1: 33.1%
Confidence Threshold
Minimum prediction confidence 0.55
Filter Mode
Filter โ€” Existing conditions + AI both required
Sample Data

Download a Sample CSV

New to the trainer? Use this sample XAUUSD M1 file (500 bars) to try the full pipeline before using your own data.

๐Ÿ“Š XAUUSD_M1_sample.csv

500 bars of synthetic XAUUSD M1 data in MT5 tab-separated format. Ready to load directly into AI Trainer Step 1.

XAUUSD M1 Timeframe 500 Bars Tab-separated ~26 KB
๐Ÿ’ก For real trading: Export your own MT5 data via Tools โ†’ History Center. We recommend 5,000โ€“200,000 bars on M1 for best results.
Generated Code Sample

What the MQ5 Code Looks Like

Here's an example of the AI signal module automatically generated and injected into your StratForge EA.

sfm5_ai_signal.mq5 MQL5
//+------------------------------------------------------------------+
//|  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); }
FAQ

Frequently Asked Questions

Common questions about AI Signal Trainer.

Does my data get uploaded to a server? โ–ผ
No. Everything runs entirely in your browser. Your CSV data, trained model, and normalization constants never leave your device. The training uses TensorFlow.js with WebGL GPU acceleration โ€” all local.
What accuracy can I expect? โ–ผ
Typical validation accuracy ranges from 50โ€“56% for M1 data. Financial time series are inherently noisy, so the AI works best as a filter alongside your existing entry conditions โ€” not as a standalone signal. Even a modest improvement in signal quality can meaningfully improve your strategy's Sharpe ratio over time.
How many bars of data do I need? โ–ผ
Minimum ~5,000 bars. We recommend 50,000โ€“200,000 bars (M1) for good generalization. More data generally produces a more robust model. The upper limit depends on your PC's RAM โ€” most modern PCs handle up to ~500,000 bars without issues.
Which MT5 build is required? โ–ผ
MT5 Build 3370 or higher is required for OnnxLoad() support. You can check your build number in MT5 under Help โ†’ About. Most up-to-date MT5 installations already meet this requirement.
Can I retrain with different settings? โ–ผ
Yes. Go back to Step 2 at any time to change features or network settings, then retrain. Each training run produces a new .onnx file. Experiment with different feature combinations and look-ahead settings to find what works best for your symbol and timeframe.
Does it work with EA Analyzer and Strategy Lab? โ–ผ
Yes. The full workflow is: train your AI model here โ†’ inject it into StratForge MT5 โ†’ run backtests in MT5 โ†’ analyze results with EA Analyzer Pro โ†’ practice and refine in Strategy Lab. All tools are designed to work together.
๐Ÿค–

Ready to Add AI to Your EA?

Launch AI Signal Trainer and follow the 5 steps above. Free, private, and browser-only.

๐Ÿš€ Launch AI Trainer Free โ†’