-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
calculation of Buy & Hold Return
#327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
One thing that is nice about the backtesting.py framework is its generic nature. I have a number of strategies and many of them rely on the entire period for a representative benchmark. Having said that, it would be nice if it were easier to specify a "warming period" for both the strategy and the benchmark. I haven't come up with a clean way to do that as of yet, though I haven't really dug into it. As a feature, it would be kind of nice if there were a way to specify a eg.
Full disclosure, I've been away for a bit so this might have been implemented in a different fashion. I'm not sure. |
Done automatically like this for backtest and plots: backtesting.py/backtesting/backtesting.py Lines 1146 to 1149 in 4f21a65
Therefore, you can extend the warming period by containing an indicator with sufficient leading np.nan values.
I like that it's done automatically. We should extended it more consistently into stats (Buy&Hold computation) — PR welcome. |
I am also having a similar issue because of non configurable warming up period explained in #477 |
Has the feature "warming_period" been added to make sure that the strategy tested and the buy and hold strategy are calculated on the same timeframe? |
this is how
Buy & Hold Return
is calculated:so it's calced use day one and the day last.
Expected Behavior
Buy & Hold Return is used for compare with strategy gain. Therefore, I guess they should started at same time, since the strategy get enough data to work on.
Take cross ma strategy example, use 5 days for short line and 10 days for long line, the strategy can only works from 10th trade day. It's better to make comparision since this day
The text was updated successfully, but these errors were encountered: