Introduction
After developing 200+ Expert Advisors, we've seen the same mistakes destroy profitability over and over. Some are obvious in hindsight. Others are subtle killers that take months to manifest.
This guide covers the 10 most common mistakes and exactly how to avoid them. If you're building an EA, consider this your pre-flight checklist.
Spoiler: Most failed EAs die from mistakes #1 and #4. Fix those first.
Mistakes 1-3: Strategy Flaws
Mistake 1: Curve Fitting (The Silent Killer)
What it is: Optimizing parameters until they perfectly fit historical data, creating an EA that "predicts the past" but fails on new data.
Signs you're curve-fitting:
How to avoid it:
``
Good: SMA period 18-22 all profitable
Bad: Only SMA 19 works, SMA 18 and 20 lose money
``
Mistake 2: Ignoring Transaction Costs
What it is: Backtesting without realistic spreads, commissions, and slippage.
The math that kills strategies:
How to avoid it:
Mistake 3: No Edge Definition
What it is: Building an EA without understanding WHY it should make money.
Questions you must answer:
Examples of real edges:
Not an edge:
Mistakes 4-6: Technical Errors
Mistake 4: No Error Handling
What it is: Assuming every order will execute perfectly.
Reality check:
The dangerous code:
``mql4
// BAD - No error handling
OrderSend(Symbol(), OP_BUY, 0.1, Ask, 3, 0, 0);
`
The safe code:
`mql4
// GOOD - Proper error handling
int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, sl, tp);
if(ticket < 0) {
int error = GetLastError();
Print("Order failed. Error: ", error, " - ", ErrorDescription(error));
if(error == ERR_REQUOTE || error == ERR_PRICE_CHANGED) {
RefreshRates();
// Retry logic here
}
}
`
Mistake 5: Magic Number Conflicts
What it is: Running multiple EAs that interfere with each other's orders.
The problem:
`mql4
// EA 1 closes EA 2's profitable trade by accident
for(int i = OrdersTotal()-1; i >= 0; i--) {
if(OrderSelect(i, SELECT_BY_POS)) {
if(OrderSymbol() == Symbol()) { // No magic number check!
OrderClose(OrderTicket(), OrderLots(), Bid, 3);
}
}
}
`
The solution:
`mql4
input int MagicNumber = 12345; // Unique per EA
// Always filter by magic number
if(OrderSelect(i, SELECT_BY_POS)) {
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
// Safe to manage this order
}
}
`
Mistake 6: Broker-Specific Code
What it is: Writing code that only works with your specific broker.
Common issues:
Universal code:
`mql4
// Works on any broker
double PipSize() {
if(Digits == 5 || Digits == 3) return Point * 10;
return Point;
}
double MinLot() { return MarketInfo(Symbol(), MODE_MINLOT); }
double StopLevel() { return MarketInfo(Symbol(), MODE_STOPLEVEL) * Point; } ``
Mistakes 7-9: Testing Problems
Mistake 7: Insufficient Testing Duration
What it is: Testing on 6 months of data and assuming it represents all market conditions.
What you miss with short tests:
Minimum testing periods:
Must include:
Mistake 8: Not Testing on Multiple Pairs
What it is: Developing for EURUSD only and expecting it to work everywhere.
Why multi-pair testing matters:
Strategy validation:
``
Strong strategy: Works on 5+ correlated pairs
Decent strategy: Works on 2-3 pairs
Weak strategy: Only works on 1 pair (likely curve-fitted)
``
Mistake 9: Skipping Forward Testing
What it is: Going straight from backtest to live trading.
The forward testing protocol:
What forward testing catches:
Mistake 10: Deployment Failures
Not Monitoring Live Performance
What it is: Turning on the EA and forgetting about it.
What can go wrong:
Monitoring checklist:
Automated monitoring:
``mql4
void SendPerformanceReport() {
string report = StringFormat(
"Daily Report\n" +
"Balance: %.2f\n" +
"Equity: %.2f\n" +
"Open Trades: %d\n" +
"Today P/L: %.2f",
AccountBalance(),
AccountEquity(),
OrdersTotal(),
CalculateTodayPL()
);
SendNotification(report); // Or email: SendMail("EA Report", report); } ``
Conclusion
Avoiding these 10 mistakes will put you ahead of 90% of EA developers:
Strategy Layer
Technical Layer
Testing Layer
Deployment Layer
One final tip: Keep a development journal. Document every change, every test result, every live observation. You'll thank yourself later.
Need a professional review of your EA? Get a free strategy audit or contact us for development assistance.