MT5 Strategy Generator: Build, Test and Export EAs on Windows
AlgoLens Factory is a Windows app that generates MetaTrader 5 strategies from the setups you choose, on your own broker’s price history. It builds thousands of versions, tests every candidate against ten robustness stages and exports only the survivors, as .mq5 source code you compile in MetaEditor. You do not write code, and nothing runs on someone else’s server.
- Runs on
- Windows 10 or 11, 64-bit, with MetaTrader 5 on the same PC
- Markets
- Any symbol your broker offers in MT5: forex, gold, indices, crypto CFDs
- Timeframes
- M1, M5, M15, M30, H1, H4, D1
- Price data
- Your broker’s M1 history through MetaTrader 5, or a CSV import
- How it generates
- Weighted random sampling of rules from a built-in setup catalogue. No AI
- Tests
- 10 robustness stages; 8 can reject a strategy
- Output
- Editable .mq5 source code for MetaTrader 5
Facts checked against the app and its license on November 9, 2026.
What it generates
A strategy in the Factory is a rule made of two to four setups that have to agree before a trade opens, plus the stop, the target and the exits. The setups come from a catalogue that covers indicators, price action, candle patterns, time of day, trading sessions and the behavior of another instrument. You start by switching on a setup family, then adjust the setups in it one by one. The twelve themed families are:
- Trend
- Reversal
- Momentum
- Channels and volatility
- Volume / flow
- Structure breakout
- Trap / reversal
- Consolidation / range
- Chart patterns
- Candlesticks
- Session and liquidity
- Asset pair
Three switches change what a rule may look at and when it may trade:
- Market regime. Trade only when volatility expands or only in quiet markets; only with a trend in place or only in a range.
- Higher timeframes. A rule on the 30-minute chart can require H1, H4 or D1 to agree first.
- A reference instrument. A move in one symbol, the dollar index for example, can be the reason a trade opens on another, such as gold.

How the generator works, in plain words

You set the field
The symbol, the timeframe, the stretch of history and the setups it may combine. The Factory reads your broker’s M1 history from MetaTrader 5 and resamples it to your timeframe.
It draws and backtests rules
It draws rules from your setups by weighted random sampling, with their numbers, stop and target, and backtests each one. The work runs in parallel on your processor’s cores, on your PC.
It screens them
A quick screen drops most versions. The rest must pass the in-sample/out-of-sample check and your filters to become candidates; mining stops when the candidate quota fills.
It stress-tests the candidates
Each candidate goes through the ten robustness stages in order. The first failure ends it, with the reason recorded.
It refines the survivors
Optionally (on by default, for the top 3), the Studio tries neighboring parameter values on approved strategies. A refined version has to pass the stages again.
You export
Each approved strategy exports as an .mq5 file. The Factory has already compared its backtest with the exported code, trade by trade.
The tests every candidate faces
In the default Preferred mode, a candidate runs through: sealed OOS2, look-ahead, parameter stability, Monte Carlo on the trade order, Monte Carlo on history noise, trade scenarios, cost stress, neighboring timeframes, neighboring markets and walk-forward. Eight of them can reject it; the sealed slice and neighboring markets only report.
The guide to the 10 robustness tests explains what each stage checks and what it takes to pass.
How strict that is shows in one real run on gold, 30-minute chart, two years of history: 138,000 versions mined, 40 candidates, 4 approved.
Inspect every trade before you export
Each strategy has a full report: summary, the in-sample/out-of-sample split, the trade list, the equity curve, Monte Carlo, walk-forward, look-ahead, trade scenarios, correlation, account management and the code. In the trade list, each trade opens as a candlestick snapshot with the entry, the stop and target and the rule’s verdict on the signal bar, so you can check that the strategy does what its rule says. The list downloads as CSV.

Export to MetaTrader 5
An approved strategy exports as one plain-text .mq5 file: the rule written out in a comment, every number as a named input, no license check inside. You compile it in MetaEditor and run it like any other EA, and under the license agreement it is yours. See what the exported file contains.
Who it is for, and who it is not for
It fits:
- traders with setups they trade by hand who want them automated and tested first (see turning your strategy into an EA);
- traders who run bought EAs and want to build their own, with rules they can read;
- anyone who wants to know why a strategy was approved, stage by stage, before it touches an account.
It does not fit if you need MetaTrader 4 or a Mac, want to import your own code or custom indicators, or expect a strategy that is promised to make money.
What you need
- Computer
- Windows 10 or 11, 64-bit. 8 GB of RAM at least, 16 GB recommended; about 300 MB of disk
- MetaTrader 5
- Installed and logged in on the same PC to download history (a demo account works), or a CSV of the history
- Internet
- Not needed to mine, test or export, except to export during the trial without a card
- Trial
- 14 days with every feature, no card; code of up to 3 different strategies
Questions
Is the Factory an AI strategy generator?
No. It does not use machine learning or a language model. It draws rules from a built-in catalogue of setups by weighted random sampling, backtests each one on your broker’s history, and keeps only the strategies that pass statistical tests you can read and change.
Which markets can it build strategies for?
Any symbol your broker offers in MetaTrader 5: forex pairs, gold, indices, crypto CFDs and so on. The Factory reads the contract details from MetaTrader, and the strategy is tested with your broker’s spread for that symbol.
Does it work with MetaTrader 4 or on a Mac?
No. The Factory runs on Windows 10 or 11 (64-bit) and exports for MetaTrader 5 only. There is no MT4 version.
Does it place trades or need my broker password?
No. The Factory only reads price history from the MetaTrader 5 terminal open on the same PC, and it never asks for a login or password. Only the EA you export and attach to a chart trades.
Can I import my own indicator or Pine Script?
No. Strategies are built only from the Factory’s catalogue of setups. If your idea uses a custom indicator, the closest you can get is to rebuild it from the setups the catalogue has.
Will a generated strategy make money?
There is no such guarantee. Approval means a strategy passed the tests you chose, on the history you chose, with your broker’s costs. Trading involves the risk of loss, and past results do not guarantee future results.
Try it on your own setups
14-day free trial with every feature, no card. You can export the code of up to 3 different strategies during the trial. Windows 10 or 11 and MetaTrader 5.