Backtesting a Bitcoin Dip-Buying Strategy with Stock-to-Flow and MACD
Summary
This educational article develops a hypothetical Bitcoin strategy in Backtrader using market prices, volume, and a stock-to-flow valuation series. It enters when the MACD signal crosses above zero while a short-to-long simple moving-average comparison still indicates a downtrend, provided the latest close is below the model valuation. A percentage trailing stop manages exits. The post describes fetching and preparing data, adding the valuation series to the backtest, and using analyzers to assess results.
The historical test spans January 2015 to May 2020 and reports four trades, three closed profitably and one still open, with a final portfolio value near $4 million from $100,000. It reports a maximum trade drawdown of 40% and a Sharpe ratio slightly above buy-and-hold, which earned more overall but had a much larger reported drawdown. These are backtest results, not evidence of future returns. The sample is small, signals require several conditions to coincide, and the article does not establish robustness across periods, parameter choices, or realistic execution assumptions.
Key ideas
- The strategy buys when the MACD signal turns positive during a measured downtrend and Bitcoin trades below stock-to-flow model value.
- A percentage trailing stop is used to exit positions after adverse price reversals.
- The historical test reports four trades over January 2015 to May 2020, with one still open at the end.
- The reported Sharpe ratio is slightly higher than buy-and-hold, while buy-and-hold produced greater total value and a larger drawdown.
- The small trade count and historical, model-dependent setup limit conclusions about robustness or future performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.