Want the full code behind this test? The Mega Backtrader Strategy Pack includes 500+ Backtrader-ready Python strategies, batch runners, dashboards, CSV metrics, chart exports, and documentation. You can get the full package here: Mega Backtrader Strategy Pack.
Price momentum is more useful when volume confirms it. This BTC-USD backtest shows a composite price-volume momentum strategy finishing at +66.82%, beating BTC buy-and-hold by more than 70 percentage points.
The test used BTC-USD daily candles from July 27, 2024 to July 27, 2026. The benchmark was BTC buy-and-hold over the same period.
| Result | Value |
|---|---|
| Strategy return | 66.82% |
| BTC buy-and-hold return | -3.69% |
| Excess return | 70.51% |
| Final portfolio value | $16,681.96 |
| Sharpe ratio | 1.21 |
| Max drawdown | 17.84% |
| Closed trades | 13 |
| Open trades | 1 |
| Win rate | 46.15% |
CompositePVMomentumStrategy is a price-volume
momentum with RSI and trailing-stop control strategy.
The strategy is aggressive enough to capture momentum but still filters for context. It requires price direction, positive momentum, above-average volume, and RSI that is not already stretched into an extreme zone.
The strategy logic is:
The strategy calculates momentum, RSI, price MA, and volume ratio:
self.rsi = bt.indicators.RSI(period=self.params.rsi_period)
self.price_ma = bt.indicators.SMA(period=self.params.price_ma_period)
self.volume_ma = bt.indicators.SMA(self.data.volume, period=self.params.volume_ma_period)
self.volume_ratio = self.data.volume / self.volume_maPrice momentum is normalized by the lookback close:
self.price_momentum = (
self.data.close - self.data.close(-self.params.momentum_period)
) / self.data.close(-self.params.momentum_period)The long signal requires trend, momentum, volume, and RSI agreement:
long_signal = (
price_above_ma and
positive_momentum and
strong_volume and
self.rsi[0] > self.params.rsi_oversold and
self.rsi[0] < self.params.rsi_overbought
)This is the benefit of packaging the idea as a Backtrader strategy: the indicator setup, signal rules, position management, and output metrics all run through the same repeatable research workflow.
| Setting | Value |
|---|---|
| Asset | BTC-USD |
| Benchmark | BTC-USD |
| Period | 2y |
| Data window | July 27, 2024 to July 27, 2026 |
| Interval | 1d |
| Starting cash | $10,000.00 |
| Final value | $16,681.96 |
| Strategy file | CompositePVMomentumStrategy.py |
| Strategy class | CompositePVMomentumStrategy |
| Metric | Value |
|---|---|
| Starting portfolio value | $10,000.00 |
| Final portfolio value | $16,681.96 |
| Strategy return | 66.82% |
| BTC buy-and-hold return | -3.69% |
| Excess return vs BTC buy-hold | 70.51% |
| Sharpe ratio | 1.21 |
| Max drawdown | 17.84% |
| Total trades | 14 |
| Closed trades | 13 |
| Open trades | 1 |
| Winning trades | 6 |
| Losing trades | 7 |
| Win rate | 46.15% |
| Runtime | 2.50 seconds |
The run ended with 1 open trade, so final equity includes mark-to-market value at the last bar while win rate is calculated from closed trades.
The equity curve shows whether the strategy built its return steadily or relied on one isolated jump. Here the comparison is especially useful because BTC buy-and-hold finished negative while the strategy finished strongly positive.
The drawdown chart shows how much pain the strategy had to absorb during the test. Return alone is not enough; a publishable strategy review needs the drawdown path next to the benchmark.
The rolling return chart shows when the strategy gained or lost its edge. This helps separate one lucky ending from a result that developed across the test window.
The daily return distribution excludes zero-return strategy days. In this run, 451 flat strategy-equity days were removed, leaving 279 non-zero strategy return days plotted.
The main lesson is not that one backtest is automatically tradable. The lesson is that the research workflow matters. A useful strategy package should let you move from idea, to code, to batch test, to metrics, to charts, to publishable research without rebuilding the same infrastructure over and over.
That is exactly what the Mega Backtrader Strategy Pack is designed to do. It gives you hundreds of ready-to-run strategy modules plus the tooling to test them across assets and time windows.
Get the full package here: Mega Backtrader Strategy Pack.
This article is for research and educational use only. Backtest results are not financial advice, investment advice, or a guarantee of future performance. Always validate strategy logic, data quality, execution assumptions, costs, slippage, and risk before using any trading system.