Ready to go further
Next: run a proper backtest
The how to backtest page covers data, costs and untouched test periods in steps.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- An open source expert advisor (EA) is a trading robot whose code you can read. Reading it does not make it good, and not reading it leaves you running someone else's rules blind.
- Test in stages: read the code, run a backtest with costs, run it on a demo account for weeks, then, only if you choose, a very small live size. Each stage catches different faults.
- In a made-up backtest of 200 trades that earns +1.20 points a trade before costs, a cost of 1.20 points a trade takes the edge to zero, and 2 points a trade turns it into -0.80 a trade (calculated by us on 31 Oct 2026, exact).
- A short test proves little: for a 40 percent win rate the rough 95 percent range is plus or minus 17.5 points over 30 trades and 3.0 over 1,000.
- This page is a method. It names no EA, recommends none, and we have not tested any EA for this page.
Why open source helps and what it does not do
An EA is a program that runs inside a trading platform and places orders by its own rules. See expert advisor for the basics. Many free EAs are shared with their source code. That gives you something a sold black box does not: you can read what it does, search it for dangerous behaviour and change it. It does not give you a tested edge. A strategy can be fully visible and still lose money, and visible code can still hide a fault you did not spot.
Stage 1: read before you run
- What it trades and when. Find the entry and exit rules in the code and write them in plain words. If you cannot, you cannot judge it.
- How it sizes. Fixed size, or growing after losses. Doubling after a loss is martingale. See martingale EA.
- Whether it has a stop. A stop on every trade, or none. Check what happens when a trade goes against it.
- Outside connections. Look for any place where it sends data to, or takes instructions from, an address on the internet. Know why.
- Hidden parts. Compiled files with no source, or code that is scrambled on purpose, are a reason to stop.
- Account actions. Anything that does more than place and manage orders in the account it is attached to.
Red flags
- No stop and a position that grows as the loss grows.
- Claims of results with no test you can repeat yourself.
- A backtest picture with a smooth rising line and no costs, no spread, no drawdown figure.
- Code you cannot read, or a file that must be run with no source.
- Settings with dozens of values and no explanation of why each has the value it has.
- A single market and period, tuned until the result looks good. See overfitting.
Stage 2: backtest with costs
Run the EA in the strategy tester of your platform on data it was not tuned on. See how to backtest and the strategy tester. Set the spread, commission and slippage to what your own broker charges, not to zero. Record the number of trades, the average win and loss, the win rate, the largest drawdown and the total result.
Worked example: costs against a small edge
The numbers are made up. A backtest of 200 trades has 40 percent winners of 12 points and 60 percent losers of 6 points. The average is 0.4 times 12 minus 0.6 times 6, which is +1.20 points a trade before costs. Spread, commission and slippage together come off every trade.
| Cost per trade (points) | Average per trade after costs | Total over 200 trades | Verdict |
|---|---|---|---|
| 0 | +1.20 | +240.00 | positive |
| 0.5 | +0.70 | +140.00 | positive |
| 1 | +0.20 | +40.00 | positive |
| 1.5 | -0.30 | -60.00 | not positive |
| 2 | -0.80 | -160.00 | not positive |
Calculated by us on 31 Oct 2026, exact for the made-up inputs. The EA that looks fine with zero cost needs costs under 1.20 points a trade to stay positive. At 1.5 points a trade the total is -60.00. This is why a test with default or zero costs is not a test. Your own costs may be higher or lower than the ones here, and they can change with the time of day and the market.
Stage 3: how much a backtest can show
A backtest tells you how rules behaved on one history. It cannot show future conditions. It cannot show how the broker will fill you, whether the data matches the real market, or whether the rules were fitted to that history. It also shows a limited sample: the fewer the trades, the wider the range of results that luck alone can give.
Stage 4: demo, then small size
- Run it on a demo account for several weeks and keep a log of every trade.
- Compare the demo results with the backtest for the same period. If they differ a lot, find out why before going further.
- Check the demo for the faults a backtest hides: missed trades, requotes, disconnections and fills at other prices. See forward testing.
- If you ever go live, use a very small size and the smallest account you can, and compare every trade with the demo.
What a backtest cannot show
- That the rules will keep working. Markets change.
- Your real fills. Real orders slip and gap. See slippage.
- That the data was right. Test data can be incomplete or smoothed.
- What happens to the account in a run of losses. Look at the largest drawdown, and at the loss streak that luck alone can produce.
- Whether the code is safe. Reading the code is the only check on that.
What this page does not tell you
It names no EA and says nothing about the quality of any. It does not say a tested EA will make money; passing every stage lowers the chance of a nasty surprise and does not remove it. For installing one, see how to install an EA.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is an open source expert advisor?
It is a trading robot for a platform such as MetaTrader that is shared with its source code, so you can read and change what it does.
Is a free EA safe to run?
Not automatically. Read the code, check what it connects to, test it in stages and use a demo account first. Never run a compiled file with no source on a funded account.
How do I test a free EA?
Read the code, backtest with your own broker costs on data it was not tuned on, run it on a demo account for weeks, and compare each stage with the one before.
How many trades does a backtest need?
More is better. For a 40 percent win rate the rough range is plus or minus about 18 points over 30 trades and about 3 over 1,000.
What are the red flags in an EA?
No stops, position size that grows after losses, results with no costs, code you cannot read, and settings tuned to look good on one market and period.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is a testing method and recommends no EA or trade.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss