
BacktestLoop
Turn trading ideas into real Python backtests
18 followers
Turn trading ideas into real Python backtests
18 followers
BacktestLoop turns plain-English trading ideas into editablePython backtests.
Generate strategy code, run it on historical stock, futures, forex, or crypto data, then inspect trades, equity curves, logs, drawdowns, and risk metrics. It is built for traders and quant builders who want a faster research loop without setting up their own data and backtesting pipeline.






the part i'd worry about is overfitting from the iteration loop itself. if someone tweaks the prompt and reruns against the same historical window ten times until the equity curve looks good, that's curve fitting even though each individual run is honest backtrader code. does backtestloop do anything to nudge people toward out-of-sample testing, or is that on the user to enforce themselves
@galdayan Yes the agent will guide the user to test the startegy on different date ranges / tickers / timeframes as well. Additionally we are currently adding a feature which will automatically analyze the strategy on many different out-of-sample market data date ranges / tickers / timeframes in parallel and test the profitability on out-of-sample data as well automatically.
We also plan to make this fully configurable / overridable via the user interface such that the user can decide the rules on how the agent should pick the date ranges / tickers / other parameters (like timeframe etc) for the out-of-sample testing (more advanced users might want to pick their own rules on this so we are planning to make it configurable)
How does the generated Python code actually hold up if I want to swap in my own custom dataset or tweak the strategy logic after the fact, is it cleanly structured or more of a black box?
@eminenv9f It's plain vanilla Python code for the Backtrader engine (which is open source), a normal bt.Strategy subclass, nothing proprietary you'd have to learn. You can inspect a real example here without signing up: https://app.backtestloop.com/strategy/oWK42LP1MOTepzwftbsKVA (click the Code tab, that's the actual file that ran).
Editing after the fact works both ways: change the Python yourself in the editor and re-run, or tell the agent what to change and it edits the file. For data, backtests currently run on our built-in market data (stocks, futures, crypto, forex, 1-second to weekly bars) - uploading your own dataset isn't supported yet but it's on our list.
In the meantime, since it's standard Backtrader, you can also copy the code out and run it on your own data locally.
Would love to see a way to compare two strategy runs side by side in the same view. Right now I can run a backtest, tweak the prompt, and run again, but flipping between tabs to compare equity curves and drawdowns makes it hard to judge if a change actually helped. An overlay or a split comparison would make iteration much faster.
@kathleencl1409
This is a really great idea. Thank you for the feedback. We will add this.
However we already have a feature that you can use for quickly going back to the previous version of the same strategy if you are iterating on the same strategy using this dropdown:
It allows you to see the previous version of the given strategy and even to revert it to a previous state if the updated results are not satisfactory (as you iterate on it with the agent)
Additionally you can check the previous strategies with this tab on the chat:
If you click on one of them it loads it on the right so you can quickly switch between them to compare.
But the side by side comparison is a really nice idea so we will add this soon as well.