Backtest a Python trading bot with costs
EA Trade TesterDemo labHow we testAll guidesFor AI agents
You can have a Python trading bot read and tested here without giving us a way to run it. We parse the .py file as text and never import, compile or run it. What our test cannot do: it cannot run your bot's own loop, its data feed or its broker calls, so anything the bot does outside its trading rules (a machine-learning model loaded from a file, a news feed, an order router) is not tested; the lab rebuilds the rules in our engine and says where the copy may differ from your code.
What does the first read look for in Python?
| What we find | Why it matters |
|---|---|
datetime.now() or time.localtime() with no time zone | the computer's clock decides the trading hours, so they move with the machine and with daylight saving |
order_send with no check of the result code | failed orders pass silently and the bot thinks it is in a trade it never opened |
except: pass | every error is hidden, so a broken part fails without a word |
| a lot or position size multiplied after trades | the martingale shape that can wipe an account |
| what looks like a password or API key in the file | we do not use it; remove it and change it |
| a syntax error | the file cannot run as sent |
Why is the .py file never run?
Running someone else's code on our servers would be a risk for every other customer, and it would test your bot on its own data feed, not on ours. Reading it as text is enough to find the faults above and to write its rules out as a rule card. You check the card, correct it, and only then is our rebuilt copy tested.
What does "approximate rebuild" mean?
When the rules use something our engine expresses differently (a pending order, an exit on an indicator, a different moving-average type), the lab lists each difference. The result is still shown, labelled approximate, and an approximate rebuild can never reach the verdict REAL. If you send your own trade list as well, the parity check compares our trades with yours.
What does the test add to my own backtest?
Recorded spreads by the hour, commission, overnight fees and a second run with extra costs, up to 16 years of prices for 8 symbols in three periods that never overlap, every calendar year, and the luck bar for the number of versions you tried. Most home-made Python backtests leave out at least one of these.
Related pages
- MQL5 / MQL4 EA code checker
- Free forex EA tester online
- EA costs: spread, commission and swap
- Test a TradingView Pine strategy elsewhere
- All EA testing guides
- EA Trade Tester home: test your EA, bot, indicator or report
Questions people ask
Do you run my Python code?
No. It is parsed as text only: never imported, compiled or run.
My bot trades crypto. Can you test it?
Our prices are EURUSD, GBPUSD, USDJPY, GBPJPY, EURJPY, AUDUSD, USDCAD, GOLD. A rule written for crypto can be tested on these, but that is a different market.
Can I send several .py files?
Yes, up to 20 files at once, with any settings file and a .txt describing the rules.
Is this financial advice?
No. It describes a test of a rebuilt copy. Not financial advice.