A toolkit of Python notebooks I wrote between 2021 and 2024 to research and validate MetaTrader 5 trading strategies: Monte Carlo simulation, bot scoring, statistics, distribution fitting, and a tick-data pipeline.
This is pre-AI-tools work. I wrote all of it by hand, before LLM coding assistants existed, while I was building and testing trading bots. I have kept the original code as-is. The only changes for publishing were English section titles, a few clarifying comments, and turning my local file paths into relative
./data/paths. Every chart below is a saved output from these notebooks, so you can see the analysis without running anything.
| Folder | Notebook | What it does |
|---|---|---|
monte-carlo/ |
FTMO Challenge simulator | Probability of passing a prop-firm challenge, by Monte Carlo |
monte-carlo/ |
Trade simulator | Monte Carlo resampling of backtest trades (risk of ruin, equity distribution) |
analysis/ |
Strategy analysis toolkit | Equity curves, drawdown, distribution fitting, filters, per-pair stats |
scoring/ |
Bot scoring system | Ranks Expert Advisors across instruments from their backtest CSVs |
statistics/ |
Per-pair statistics | Distribution fitting and statistics per currency pair |
data-pipeline/ |
Dukascopy tick pipeline | Loads and reshapes large tick CSVs with Dask |
The piece I am most proud of. A backtest gives you one equity curve. That single ordering of trades tells you almost nothing about risk. So I take a strategy's historical trades and run thousands of randomized re-orderings, then measure how often the account hits the profit target before it breaks a daily-loss or max-drawdown rule.
The output is a probability, not a single result: how likely the strategy passes, and how long it typically takes.
The same Monte Carlo engine, applied to raw backtest trades, shows the spread of possible equity outcomes and the drawdowns you should actually expect:
I did not want to assume trade returns were normal, so I fit distributions to them and compared. This fed into position sizing and into the Monte Carlo resampling above.
Reusable routines for reading MetaTrader backtest exports and turning them into the views that actually matter: equity with peak/trough markers, and correlation between strategies and pairs (so I was not stacking the same bet twice).
When I had many bots across many instruments, I needed one comparable number. The scoring notebook reads each bot's backtest CSVs and combines performance metrics into a single score so I could rank them objectively instead of eyeballing curves.
Tick data from Dukascopy comes in large CSV exports. The pipeline notebook uses Dask to load and reshape them efficiently for backtesting and analysis, instead of choking pandas on files that do not fit comfortably in memory.
These notebooks read CSV exports from MetaTrader backtests and from Dukascopy tick data. The paths point at a local ./data/ folder. To re-run, drop your own exports there and adjust the file names. The saved outputs are kept inside the notebooks, so they render fully on GitHub as-is.
Stack: Python, pandas, numpy, scipy, matplotlib, seaborn, Dask.








