MQL5 Wizard EA: Build & Test Guide
In this article
Yes, you can build a MetaTrader 5 Expert Advisor (EA) using the MQL5 Wizard and test it in the Strategy Tester — it is a built-in feature that generates a working EA from modular components without manual coding. This article explains exactly how to do it, what the Wizard can and cannot do, and how to run meaningful tests before risking real money.
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
What Is the MQL5 Wizard?
The MQL5 Wizard is a code generator built into the MetaEditor IDE that ships with MetaTrader 5. It creates a complete, compilable Expert Advisor by letting you pick from pre-defined modules: signal generation, money management, trailing stop, and risk control. You do not write a single line of code — you select options from drop-down lists and checkboxes, and the Wizard writes the EA for you. The generated EA is a real .mq5 file that you can modify later if you learn MQL5.
How to Build an EA with the Wizard
- Open MetaEditor (F4 in MetaTrader 5) and go to File → New → Expert Advisor (generate).
- Enter a name for your EA (e.g., “MyWizardEA”) and click Next.
- Choose a signal module — this is the core trading logic. Built-in options include Moving Average, RSI, MACD, Stochastic, and several others. You can pick one or combine up to four signals with a logical condition (AND/OR).
- Select a trailing stop module (e.g., Parabolic SAR, Chandelier, or none).
- Choose a money management module: Fixed Lot, Fixed Fractional, or Fixed Ratio.
- Set risk parameters (e.g., stop loss in points, take profit in points, and risk percentage).
- Click Finish — the Wizard generates the .mq5 file and opens it in the editor.
- Press F7 to compile. If there are no errors, the EA appears in the Navigator under Expert Advisors.
How to Test the Generated EA
Once compiled, you can test the EA in the MetaTrader 5 Strategy Tester. Open the tester (View → Strategy Tester or Ctrl+R), select your EA, choose a currency pair and timeframe, set the testing period (e.g., the last two years), and pick a simulation mode (every tick, 1-minute OHLC, or open prices). Click Start. The tester will run the EA on historical data and produce a report with metrics like net profit, drawdown, profit factor, and number of trades. You can also visualize the trades on a chart by enabling the “Visual mode” checkbox before starting.
Choosing the Right Modules
The signal modules in the Wizard are based on classic technical indicators. For example, the Moving Average module generates buy and sell signals when a fast MA crosses above or below a slow MA. The RSI module uses overbought/oversold levels. When you combine multiple signals, the EA only trades when all conditions are met (if you choose AND) or when any condition is met (if you choose OR). For a first test, a simple single-signal EA with a Moving Average crossover is a good starting point — it is easy to understand and the results are easy to interpret. You can later add a trailing stop and change money management to see how each component affects performance.
Common Problems and Misconceptions
One common misconception is that the Wizard can create any EA you can imagine. In reality, it only supports the built-in modules — you cannot add custom indicators or complex logic without manual coding. Another issue is that the generated EA may not have a stop loss or take profit if you set them to zero; the Wizard will still compile, but the EA will trade without a protective stop, which is dangerous. Also, many users forget to enable “Allow Algo Trading” in MetaTrader 5 (the button at the top toolbar) before testing — the tester will not run if it is off. Finally, the Strategy Tester results are only as good as the data quality; make sure you have downloaded full history (Tools → History Center) and that your test period includes different market conditions.
Costs and Safety
The MQL5 Wizard is completely free — it is part of MetaTrader 5, which is also free to use. There are no hidden charges for generating an EA. However, if you later decide to use a paid signal module from the MQL5 Market, that would cost money, but the built-in modules are free. Safety-wise, always test any EA on a demo account or in the Strategy Tester before using it live. The Wizard-generated EA is not guaranteed to be profitable; it is a tool to help you learn and prototype. Never risk money you cannot afford to lose, and always use a stop loss.
Alternatives to the Wizard
If the Wizard does not meet your needs, you have several alternatives: you can write your own EA from scratch in MQL5, hire a programmer, or purchase an EA from the MQL5 Market. Writing your own code gives you full control but requires learning the MQL5 language. The MQL5 documentation and forums are good resources. Another option is to use the Strategy Tester’s built-in optimization feature to find the best parameters for your Wizard-generated EA — this is a powerful way to improve performance without changing the code.
Frequently Asked Questions
Can I add my own indicator to the Wizard?
No, the Wizard only supports the built-in signal modules. To use a custom indicator, you must write the EA manually or modify the generated code.
Why does my EA not trade in the tester?
Check that “Allow Algo Trading” is enabled, that you have selected the correct timeframe and symbol, and that the EA’s input parameters (like stop loss) are set to non-zero values. Also, make sure the test period has enough price data.
Is the Wizard EA profitable?
Not necessarily. The Wizard generates a basic EA that follows your chosen logic; profitability depends on market conditions, parameters, and risk management. Always backtest and forward-test on a demo account.
Can I modify the generated code?
Yes, the generated .mq5 file is fully editable. You can open it in MetaEditor and change any part of the logic, but you need to understand MQL5 to avoid breaking the code.
Does the Wizard work in MetaTrader 4?
No, the MQL5 Wizard is only for MetaTrader 5. MetaTrader 4 has a similar code generator, but it is less advanced and uses MQL4.