Ever wondered what actually goes into building a real, profitable EA? Here's my complete development process — exactly what I do when a client comes to me with a strategy.
When a client comes to me with a trading strategy, there's a clear process I follow. It's not about just writing code — it's about building something that actually works in live market conditions.
Here's exactly how I build a custom MT5 EA from scratch.
Step 1: Strategy Analysis & Requirements
The first step is understanding your strategy completely. I ask:
- What are your entry conditions? (indicators, price action, time-based?)
- What are your exit conditions? (target, trailing stop, time exit?)
- What pairs do you trade? What timeframes?
- What's your risk model? (fixed lot, percentage of equity, martingale?)
- Any special rules? (no trading on Fridays, avoid news, etc.)
- What's your target broker / account type?
This phase usually takes 1-2 sessions via call or chat. The clearer the strategy, the faster the build.
Step 2: Strategy Design & Architecture
Before writing a single line of code, I design the EA's architecture:
- Signal module — handles entry condition logic.
- Order management module — opens, modifies, closes trades.
- Risk management module — calculates lot sizes, manages exposure.
- Filter module — news filter, time filter, trend filter.
- Logging module — records all EA decisions for review.
This modular approach means the code is clean, readable, and easy to update later.
Step 3: MQL5 Code Development
Now I write the code in MQL5 — the programming language of MT5. This is where the strategy becomes a robot.
Entry signal check: IF RSI(14) < 30 AND price > 50EMA AND spread < 20 AND no open trades AND time is London session THEN send BUY order with lot = (equity * risk%) / (SL * pip_value).
Every parameter is made into an input variable, so you can adjust it without re-coding. Want to change RSI from 30 to 25? Just change the input in MT5 settings.
Step 4: Backtesting
Once the code compiles without errors, I run it through the MT5 Strategy Tester.
- Mode: Every tick based on real ticks (highest accuracy).
- Period: Minimum 3 years. Usually 5-10 years.
- Multiple pairs and timeframes.
- Various market conditions — trending, ranging, high volatility.
- Check key metrics: profit factor, drawdown, win rate, Sharpe ratio.
A healthy EA should show: Profit Factor > 1.5, Max Drawdown < 20%, Win Rate > 45% (for 1:2 RR), Consistent equity curve without huge flat periods.
Step 5: Optimization
After initial backtesting, I run the genetic optimizer to find the best parameter ranges. But I'm careful here — over-optimization (curve fitting) makes the EA look great on historical data but fail on live markets.
I test the optimized parameters on out-of-sample data (data the EA was not optimized on). If it performs similarly, the parameters are robust.
Step 6: Demo & Forward Testing
I run the EA live on a demo account for 2-4 weeks. This catches any issues that backtesting misses — like broker-specific behavior, spread spikes, or execution quirks.
Step 7: Delivery & Live Deployment
I deliver:
- The compiled EA file (.ex5) — ready to run in MT5.
- Full source code (.mq5) — you own it completely.
- Documentation — what every parameter does, setup instructions.
- Backtest reports — PDF showing the strategy's historical performance.
- Setup call or video guide — I walk you through installation on your VPS or PC.
How Long Does It Take?
- Simple single-strategy EA: 1-2 weeks.
- Multi-strategy or multi-pair EA: 3-4 weeks.
- Complex systems (grid + hedge + filters): 4-6 weeks.
Conclusion
Building a good EA is a process. Not a quick job. When done right, it becomes a reliable trading system that works for you around the clock.
If you have a strategy you believe in — let's turn it into a robot.
Ready to automate your trading strategy? I've built 500+ EAs and have a 98% client satisfaction rate. Let's talk about your project at 4xfree.com. Free consultation included.
Contact Me at 4xfree.com