99% of beginners get backtesting wrong:
Build backtest, get poor results. Tweak backtest, get positive results.
Then they wonder why they lose money.
Here's the dead-simple framework the pros use to get backtesting right:
Build backtest, get poor results. Tweak backtest, get positive results.
Then they wonder why they lose money.
Here's the dead-simple framework the pros use to get backtesting right:
If you replicate this framework, youβll:
β’ Setup a backtest with bt
β’ Run a backtest and analyze results
β’ Assess how random your results are
Plus, youβll dramatically reduce the risk of your strategy performing poorly in the market after a great backtest.
But firstβ¦
β’ Setup a backtest with bt
β’ Run a backtest and analyze results
β’ Assess how random your results are
Plus, youβll dramatically reduce the risk of your strategy performing poorly in the market after a great backtest.
But firstβ¦
In case youβre new to backtesting.
It's used to:
β’ Simulate how a strategy might perform live
β’ Test trading ideas against historic market data
β’ Optimize for performance parameters like Sharpe
It's easy to setup but hard to get right.
Hereβs how to do it with Python.
It's used to:
β’ Simulate how a strategy might perform live
β’ Test trading ideas against historic market data
β’ Optimize for performance parameters like Sharpe
It's easy to setup but hard to get right.
Hereβs how to do it with Python.
Fund managers report their holdings monthly.
So they sell losing stocks and buy higher quality assets, like bonds.
We might be able to take advantage of this effect by buying bonds toward the end of the month and selling them at the beginning.
Let's find out.
So they sell losing stocks and buy higher quality assets, like bonds.
We might be able to take advantage of this effect by buying bonds toward the end of the month and selling them at the beginning.
Let's find out.
Huh?
The harsh truth is most strategies are random.
A random strategy will produce positive results in 50% of cases and negative results in 50% of cases.
Results will rarely be 0.
What do beginners do with a negative result?
Tweak the backtest.
So how do you avoid it?
The harsh truth is most strategies are random.
A random strategy will produce positive results in 50% of cases and negative results in 50% of cases.
Results will rarely be 0.
What do beginners do with a negative result?
Tweak the backtest.
So how do you avoid it?
Backtest the backtest.
Youβre going to run a simulation of backtests, plot the resulting Sharpe ratios, and see where your backtestβs Sharpe ratio is on the distribution.
This tells you how random your backtest result it.
Youβre going to run a simulation of backtests, plot the resulting Sharpe ratios, and see where your backtestβs Sharpe ratio is on the distribution.
This tells you how random your backtest result it.
Reduce the risk of your strategy performing poorly in the market.
Avoid the problems 99% of beginners face.
Now you can:
β’ Setup a backtest with bt
β’ Run a backtest and analyze results
β’ Assess how good your backtest really is
Avoid the problems 99% of beginners face.
Now you can:
β’ Setup a backtest with bt
β’ Run a backtest and analyze results
β’ Assess how good your backtest really is
Click the link below to hop to the top tweet.
Then retweet so you can save this thread for later and share with your audience!
And if you like threads about trading and building backtests with Python, follow @pyquantnews for daily content.
Then retweet so you can save this thread for later and share with your audience!
And if you like threads about trading and building backtests with Python, follow @pyquantnews for daily content.
If you like threads about backtesting, you might enjoy my weekly newsletter: The PyQuant Newsletter.
Real Python code for quant finance you can use now.
Join 7,800+ subscribers who are taking action with Python.
pyquantnews.com
Real Python code for quant finance you can use now.
Join 7,800+ subscribers who are taking action with Python.
pyquantnews.com
Loading suggestions...