Classification models output not just a class label but a probability for each class. A binary classifier returns numbers like [0.62, 0.38] — "62% confidence in class 0, 38% in class 1." Most EAs that use a classifier ignore the probability and just take the argmax. That's leaving information on the table. The probability is itself a signal — high-confidence predictions are more reliable than low-confidence ones.

The pattern

Instead of: "trade when the model says buy," use: "trade only when the model says buy with at least X% confidence." Sweep X from 0.50 (no filter) up to ~0.75 and pick the threshold that maximizes Sharpe in walk-forward testing.

confidence_filter.mq5
input double InpMinConfidence = 0.60; void OnTick() { matrixf in(1, n_features); vectorf probs(2); FillFeatures(in); OnnxRun(hModel, ONNX_NO_CONVERSION, in, probs); double p_long = probs[1]; double p_short = probs[0]; if(p_long > InpMinConfidence) PlaceBuy(); else if(p_short > InpMinConfidence) PlaceSell(); }

Sizing by confidence (advanced)

size by confidence
double LotSizeFromConfidence(double conf) { if(conf < 0.55) return 0.0; if(conf > 0.90) conf = 0.90; return 0.1 + (conf - 0.55) * 2.0; }

Calibration caveat

The output probability is only meaningful if the model is well-calibrated — meaning that predictions with 70% confidence are correct about 70% of the time. Tree-based models and neural nets are not calibrated by default; they tend to be overconfident. Practical fixes: