Get the full strategy library: This article uses one strategy from the Mega Backtrader Strategy Pack, a package of 500+ Backtrader-ready Python trading strategies with batch backtesting, dashboards, metrics, charts, and documentation.
Download the package here: Mega Backtrader Strategy Pack
If you want a ready-made research workflow for testing many Backtrader strategies across crypto, stocks, ETFs, and other markets, this package gives you the strategy code, runners, reports, and charts in one place.
Bitcoin is often noisy enough to punish simple trend-following rules, but it also produces long directional phases where structure matters. The Ichimoku Cloud is useful in that environment because it combines trend direction, momentum confirmation, and support/resistance context in one framework.
This article walks through IchimokuCloudStrategy, one of
the strategies included in the Mega Backtrader Strategy Pack. The
strategy was tested on BTC-USD daily candles from July 23, 2024
to July 23, 2026.
The result:
| Result | Value |
|---|---|
| Strategy return | 72.33% |
| BTC buy-and-hold return | -1.44% |
| Excess return | 73.77% |
| Sharpe ratio | 1.58 |
| Max drawdown | 9.02% |
| Closed trades | 55 |
| Open trades | 0 |
| Win rate | 45.45% |
The important part is not just the final return. The strategy made 55 closed trades, kept max drawdown near 9%, and outperformed BTC buy-and-hold by 73.77 percentage points over the same test window.
IchimokuCloudStrategy trades confirmed cloud
breakouts.
The logic uses three Ichimoku confirmations:
When all bullish conditions align, the strategy opens a long position. When all bearish conditions align, it opens a short position. After entry, risk is managed with a trailing stop.
That gives the system a clear purpose: participate when BTC has enough directional structure, and avoid treating every candle as a trade signal.
The strategy uses compact Ichimoku settings:
params = (
('tenkan', 6),
('kijun', 12),
('senkou', 24),
('senkou_lead', 12),
('chikou', 12),
('trail_percent', 0.01),
)These values control:
tenkan: the fast conversion line.kijun: the slower base line.senkou: the cloud calculation window.senkou_lead: how far the cloud is projected
forward.chikou: how far back the lagging span is compared.trail_percent: the trailing stop percentage after
entry.The strategy starts by creating Backtrader's built-in Ichimoku indicator:
self.ichimoku = bt.indicators.Ichimoku(
self.datas[0],
tenkan=self.p.tenkan,
kijun=self.p.kijun,
senkou=self.p.senkou,
senkou_lead=self.p.senkou_lead,
chikou=self.p.chikou,
)For a bullish setup, price must trade above both cloud spans:
is_above_cloud = (
self.data.close[0] > self.ichimoku.senkou_span_a[0] and
self.data.close[0] > self.ichimoku.senkou_span_b[0]
)The fast Ichimoku line also needs to be above the slower line:
is_tk_cross_bullish = (
self.ichimoku.tenkan_sen[0] >
self.ichimoku.kijun_sen[0]
)The Chikou Span then confirms that current trend pressure is stronger than prior price action:
is_chikou_bullish = (
self.ichimoku.chikou_span[0] >
self.data.high[-self.p.chikou]
)Only when all three bullish filters pass does the strategy buy:
if is_above_cloud and is_tk_cross_bullish and is_chikou_bullish:
self.order = self.buy()The bearish side mirrors the same structure. Price must be below the cloud, Tenkan-sen must be below Kijun-sen, and Chikou Span must be below the prior low:
is_below_cloud = (
self.data.close[0] < self.ichimoku.senkou_span_a[0] and
self.data.close[0] < self.ichimoku.senkou_span_b[0]
)
is_tk_cross_bearish = (
self.ichimoku.tenkan_sen[0] <
self.ichimoku.kijun_sen[0]
)
is_chikou_bearish = (
self.ichimoku.chikou_span[0] <
self.data.low[-self.p.chikou]
)
if is_below_cloud and is_tk_cross_bearish and is_chikou_bearish:
self.order = self.sell()After a completed entry, the strategy places a trailing stop in the opposite direction:
if order.isbuy():
self.sell(
exectype=bt.Order.StopTrail,
trailpercent=self.p.trail_percent,
)
elif order.issell():
self.buy(
exectype=bt.Order.StopTrail,
trailpercent=self.p.trail_percent,
)This makes the strategy more practical than a raw cloud breakout. It does not only enter on trend confirmation; it also defines how the position should be protected after entry.
The article result can be reproduced with:
python run_backtest.py --fast --fast-plots --fast-equity \
--workers 1 \
--symbol BTC-USD \
--period 2y \
--interval 1d \
--benchmark BTC-USD \
--stake-percent 99 \
--strategies strategies \
--out results \
--strategy-filter IchimokuCloudStrategyBacktest setup:
| Setting | Value |
|---|---|
| Asset | BTC-USD |
| Benchmark | BTC-USD buy-and-hold |
| Period | 2y |
| Data window | July 23, 2024 to July 23, 2026 |
| Interval | 1d |
| Starting cash | $10,000 |
| Final value | $17,232.65 |
| Strategy file | strategies/IchimokuCloudStrategy.py |
| Metric | Value |
|---|---|
| Strategy return | 72.33% |
| BTC buy-and-hold return | -1.44% |
| Excess return vs benchmark | 73.77% |
| Sharpe ratio | 1.58 |
| Max drawdown | 9.02% |
| Total trades | 55 |
| Closed trades | 55 |
| Open trades | 0 |
| Winning trades | 25 |
| Losing trades | 30 |
| Win rate | 45.45% |
| Runtime | 2.56 seconds |
The strategy won fewer than half of its trades, but the full system still finished strongly. That is a useful point for strategy research: win rate alone does not explain performance. Position management, trend capture, and loss control matter.
The equity curve shows the strategy growing from $10,000 to $17,232.65 while BTC buy-and-hold ended slightly negative over the same two-year period.
The drawdown chart shows the strategy's largest pullback at 9.02%. For a daily BTC system, that is a controlled risk profile relative to the volatility of the asset.
The rolling return chart shows how the strategy's advantage developed through the test window instead of depending on only one isolated move.
The daily return distribution gives a compact view of the strategy's day-to-day behavior during the test.
This backtest is a good example of why it helps to have a large strategy library instead of starting from a blank file every time.
With the Mega Backtrader Strategy Pack, the workflow is repeatable:
strategies/ package.For this BTC-USD run, the Ichimoku approach worked because it required multiple trend confirmations before entering and used trailing stops after entry. It was not trying to predict every candle. It waited for cloud structure, line confirmation, and lagging-span confirmation to align.
IchimokuCloudStrategy is one of 500+
Backtrader-ready strategies included in the Mega
Backtrader Strategy Pack.
Get the full package here: Mega Backtrader Strategy Pack
The package includes:
strategies/
package.The package is useful both as a research toolkit and as a content engine. You can test strategies across assets, find strong case studies, inspect the logic, and publish complete articles with code, results, and charts.
Get the 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.