Home › Guides › Open Source Expert Advisors

WHY BOTS FAILFREENO ACCOUNTAUTOMATED TRADE BOTSOpen Source ExpertAdvisorsThe arithmetic of how bots failEDUCATION ONLY | NO SIGNALSEXAMPLE NUMBERS ARE LABELLEDAUTOMATED TRADE BOTSautomatedtradebots.com
A free page on open source expert advisors. Education only, with example numbers labelled.
WHY BOTS FAIL

Open Source Expert Advisors

Short answer

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.

Free EAs come with their code, which makes them easier to check than a black box. This page is a method for testing one before it goes near a demo or live account. It names no EA and recommends none.

The page explains the idea in plain words, works through the arithmetic with a table, and shows how it hits grid, martingale and DCA bots, then tells you what to check before you run one.

  • A worked example with real arithmetic
  • How it hits grid, martingale and DCA bots
  • How to check for it before you run a bot
  • No advice, no signals, no profit promises

Last reviewed 28 October 2026. Education only, not advice.

Free, no account Runs in your browser Worked numbers shown Not advice Examples labelled

Ready to go further

Next: run a proper backtest

The how to backtest page covers data, costs and untouched test periods in steps.

Read how to backtestFree, no account
Reading time5 minutes
Worked exampleExact arithmetic
Tools linked0 on this page
Reviewed28 Oct 2026

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
The same made-up backtest of 200 trades after different costs per trade (total points)+240.00 a tradecost in points+140.00.5 a tradecost in points+40.01 a tradecost in points-60.01.5 a tradecost in points-160.02 a tradecost in points40 percent wins of 12 points, 60 percent losses of 6 points, 200 trades, so +1.2 points a trade before costs. Made-up. Calculated by us on31 Oct 2026, exact.
The picture for this page. Example numbers are made up unless the page says they were calculated.

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 costsTotal over 200 tradesVerdict
0+1.20+240.00positive
0.5+0.70+140.00positive
1+0.20+40.00positive
1.5-0.30-60.00not positive
2-0.80-160.00not 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.

How wide the rough 95 percent range around an observed 40 percent win rate is, by number of trades17.5 pts30 tradesplus or minus9.6 pts100 tradesplus or minus6.8 pts200 tradesplus or minus3.0 pts1000 tradesplus or minus1.96 times the square root of 0.4 times 0.6 divided by the number of trades, in percentage points. A rough textbook formula forindependent trades. Calculated by us on 31 Oct 2026.
With few trades an observed win rate is a very rough figure. A hundred trades still leave a range of nearly 10 points either side.

Stage 4: demo, then small size

  1. Run it on a demo account for several weeks and keep a log of every trade.
  2. Compare the demo results with the backtest for the same period. If they differ a lot, find out why before going further.
  3. Check the demo for the faults a backtest hides: missed trades, requotes, disconnections and fills at other prices. See forward testing.
  4. 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.
This page is a testing method, not a recommendation of any EA. We have not tested any EA for this page. Trading can lose all the money put into it. The numbers are made up, and your costs and rules will differ.

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.

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