1 related strategy (⧉ identical code, ≈ similar name)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | """ ICT 4H V2 — Tuned variants V2a: CHoCH-only, 5 of 5 conditions required (strictest) V2b: Remove OB, focus on sweep + fib + trend (3 factors) V2c: Long only, fib discount entry + trend alignment """ from pandas import DataFrame import pandas as pd import talib.abstract as ta import numpy as np from freqtrade.strategy import IStrategy def _build_base(d): d['swing_high'] = (d['high'] > d['high'].shift(1)) & (d['high'] > d['high'].shift(2)) & (d['high'] >= d['high'].shift(-1)) & (d['high'] >= d['high'].shift(-2)) d['swing_low'] = (d['low'] < d['low'].shift(1)) & (d['low'] < d['low'].shift(2)) & (d['low'] <= d['low'].shift(-1)) & (d['low'] <= d['low'].shift(-2)) d['last_sh'] = d['high'].where(d['swing_high']).ffill() d['last_sl'] = d['low'].where(d['swing_low']).ffill() d['bos_bull'] = d['close'] > d['last_sh'].shift(1) d['bos_bear'] = d['close'] < d['last_sl'].shift(1) d['bull_bos_6'] = d['bos_bull'].rolling(6).sum() d['bear_bos_6'] = d['bos_bear'].rolling(6).sum() d['choch_bear'] = d['bos_bear'] & (d['bull_bos_6'].shift(1) >= 2) d['choch_bull'] = d['bos_bull'] & (d['bear_bos_6'].shift(1) >= 2) d['hh_20'] = d['high'].rolling(20).max() d['ll_20'] = d['low'].rolling(20).min() d['sweep_high'] = (d['high'] >= d['hh_20'].shift(1) * 0.997) & (d['close'] < d['hh_20'].shift(1) * 0.995) d['sweep_low'] = (d['low'] <= d['ll_20'].shift(1) * 1.003) & (d['close'] > d['ll_20'].shift(1) * 1.005) d['swing_high_30'] = d['high'].rolling(30).max() d['swing_low_30'] = d['low'].rolling(30).min() sr = d['swing_high_30'] - d['swing_low_30'] d['fib_062'] = d['swing_high_30'] - sr * 0.618 d['fib_079'] = d['swing_high_30'] - sr * 0.786 d['fib_050'] = d['swing_high_30'] - sr * 0.50 d['fib_062_s'] = d['swing_low_30'] + sr * 0.618 d['fib_079_s'] = d['swing_low_30'] + sr * 0.786 d['in_discount'] = d['close'] <= d['fib_050'] d['in_premium'] = d['close'] >= d['fib_050'] d['e50'] = ta.EMA(d, 50) d['e200'] = ta.EMA(d, 200) d['rsi'] = ta.RSI(d, 14) d['adx'] = ta.ADX(d, 14) d['di_plus'] = ta.PLUS_DI(d, 14) d['di_minus'] = ta.MINUS_DI(d, 14) d['vr'] = d['volume'] / ta.SMA(d['volume'], 10) d['atr'] = ta.ATR(d, 14) body = (d['close'] - d['open']).abs() d['displacement'] = body > body.rolling(20).mean() * 1.5 return d # ============================================================ # V2a: CHoCH + sweep + fib ONLY (pure ICT structure) # ============================================================ class ICT_CHoCH_Pure(IStrategy): INTERFACE_VERSION = 3; timeframe = '4h'; can_short = True stoploss = -0.03; trailing_stop = True trailing_stop_positive = 0.01; trailing_stop_positive_offset = 0.025 trailing_only_offset_is_reached = True minimal_roi = {"0": 0.12, "1440": 0.08, "4320": 0.04, "8640": 0} max_open_trades = 4; startup_candle_count = 200 process_only_new_candles = True; use_exit_signal = False def populate_indicators(self, d, m): d = _build_base(d) # Stronger displacement d['strong_displace'] = d['displacement'] & (d['vr'] > 1.2) return d def populate_entry_trend(self, d, m): # LONG: CHoCH bull after bear run + sweep low + in discount + strong ADX long_cond = ( d['choch_bull'] & (d['sweep_low'] | d['in_discount']) & d['strong_displace'] & (d['adx'] > 22) & (d['di_plus'] > d['di_minus']) & d['rsi'].between(30, 60) & (d['volume'] > 0) ) d.loc[long_cond, ['enter_long', 'enter_tag']] = (1, 'CH_L') # SHORT: CHoCH bear after bull run + sweep high + in premium + strong ADX short_cond = ( d['choch_bear'] & (d['sweep_high'] | d['in_premium']) & d['strong_displace'] & (d['adx'] > 22) & (d['di_minus'] > d['di_plus']) & d['rsi'].between(40, 70) & (d['volume'] > 0) ) d.loc[short_cond, ['enter_short', 'enter_tag']] = (1, 'CH_S') return d def populate_exit_trend(self, d, m): return d # ============================================================ # V2b: Sweep-only — liquidity grab reversal # ============================================================ class ICT_SweepOnly(IStrategy): INTERFACE_VERSION = 3; timeframe = '4h'; can_short = True stoploss = -0.025; trailing_stop = True trailing_stop_positive = 0.008; trailing_stop_positive_offset = 0.020 trailing_only_offset_is_reached = True minimal_roi = {"0": 0.10, "1440": 0.06, "4320": 0.03, "8640": 0} max_open_trades = 4; startup_candle_count = 200 process_only_new_candles = True; use_exit_signal = False def populate_indicators(self, d, m): d = _build_base(d) return d def populate_entry_trend(self, d, m): # LONG: sweep below 20-low then reversal candle closes green long_cond = ( d['sweep_low'] & (d['close'] > d['open']) & # reversal candle (d['close'] > d['e50']) | d['bos_bull'] & (d['in_discount']) & (d['rsi'] > 35) & (d['volume'] > 0) ) # Properly group the OR conditions long_final = ( (d['sweep_low'] & (d['close'] > d['open']) & (d['rsi'] > 35)) | (d['bos_bull'] & d['in_discount'] & (d['rsi'] > 35)) ) & (d['volume'] > 0) d.loc[long_final, ['enter_long', 'enter_tag']] = (1, 'SW_L') short_final = ( (d['sweep_high'] & (d['close'] < d['open']) & (d['rsi'] < 65)) | (d['bos_bear'] & d['in_premium'] & (d['rsi'] < 65)) ) & (d['volume'] > 0) d.loc[short_final, ['enter_short', 'enter_tag']] = (1, 'SW_S') return d def populate_exit_trend(self, d, m): return d # ============================================================ # V2c: Long-only, fib discount entry with trend # ============================================================ class ICT_LongOnly(IStrategy): INTERFACE_VERSION = 3; timeframe = '4h'; can_short = False stoploss = -0.03; trailing_stop = True trailing_stop_positive = 0.01; trailing_stop_positive_offset = 0.025 trailing_only_offset_is_reached = True minimal_roi = {"0": 0.12, "1440": 0.08, "4320": 0.04, "8640": 0} max_open_trades = 3; startup_candle_count = 200 process_only_new_candles = True; use_exit_signal = False def populate_indicators(self, d, m): d = _build_base(d) d['ema_cross'] = ta.EMA(d, 20) > ta.EMA(d, 50) return d def populate_entry_trend(self, d, m): cond = ( (d['close'] > d['e200']) & # macro trend up d['ema_cross'] & # EMA aligned d['in_discount'] & # buying at a discount (d['rsi'] < 50) & # not overbought (d['sweep_low'] | (d['close'] < d['e50'])) & # swept or pulled back (d['adx'] > 18) & (d['di_plus'] > d['di_minus']) & (d['volume'] > 0) ) d.loc[cond, ['enter_long', 'enter_tag']] = (1, 'L_disc') return d def populate_exit_trend(self, d, m): return d |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 17.5s
ℹ️ This strategy uses a trailing stop — freqtrade only
re-checks these once per 4h candle by default, not against the price movement within it.
For a more accurate read, re-run this backtest locally with --timeframe-detail 1m
(or 5m — freqtrade's own docs use 5m detail for an hourly strategy as a lighter
alternative). Freqle doesn't do this for every check here: multiplying every
League/sweep backtest by a finer detail timeframe is more compute than the sandbox can sustain
across every indexed strategy. why this matters →
- profit isn't statistically significant (p=0.55) — hard to tell apart from luck
- only 43% of resampled runs were profitable
- did not beat simply holding the market
Resampling the trade sequence 2,000× shows the spread of results this edge could plausibly produce — separating a dependable strategy from one that got lucky once.
Loading charts…
Monthly breakdown
| Month | Regime | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|---|
| Dec 2025 | bearish trending low vol | 1 | +0.22 | 2.17 | 1 | 0 | 100.0 | -1.27 | 12h 00m |
| Oct 2025 | bearish trending low vol | 7 | -0.77 | -1.10 | 3 | 4 | 42.9 | -1.48 | 4h 00m |
| Sep 2025 | bullish choppy low vol | 1 | +0.20 | 1.99 | 1 | 0 | 100.0 | -0.73 | 20h 00m |
| Aug 2025 | bearish choppy low vol | 2 | -0.15 | -0.85 | 1 | 1 | 50.0 | -1.06 | 2h 00m |
| Jul 2025 | bullish choppy low vol | 1 | +0.16 | 1.57 | 1 | 0 | 100.0 | -0.78 | 20h 00m |
| Apr 2025 | bullish choppy low vol | 3 | -0.28 | -0.70 | 1 | 2 | 33.3 | -0.93 | 34h 40m |
| Jan 2025 | bearish choppy low vol | 2 | +0.26 | 1.33 | 1 | 1 | 50.0 | -0.66 | 14h 00m |
| Sep 2024 | bearish choppy low vol | 1 | -0.30 | -2.99 | 0 | 1 | 0.0 | -0.92 | 52h 00m |
| Jul 2024 | bearish trending low vol | 1 | +0.30 | 3.01 | 1 | 0 | 100.0 | -0.62 | 36h 00m |
| May 2024 | bullish choppy high vol | 1 | -0.31 | -3.16 | 0 | 1 | 0.0 | -0.92 | 56h 00m |
| Nov 2023 | bullish trending low vol | 2 | -0.62 | -3.08 | 0 | 2 | 0.0 | -0.61 | 12h 00m |
| Aug 2023 | bearish choppy low vol | 1 | +0.20 | 2.05 | 1 | 0 | 100.0 | 0.0 | 20h 00m |
| Jul 2023 | bullish trending low vol | 1 | +0.14 | 1.39 | 1 | 0 | 100.0 | 0.0 | 0h 00m |
| Jun 2023 | bullish trending low vol | 1 | +0.40 | 4.17 | 1 | 0 | 100.0 | 0.0 | 20h 00m |
| Apr 2023 | bullish trending low vol | 1 | +0.14 | 1.40 | 1 | 0 | 100.0 | 0.0 | 0h 00m |
| Mar 2023 | bullish trending high vol | 3 | +0.41 | 1.41 | 3 | 0 | 100.0 | -0.3 | 0h 00m |
| Dec 2022 | bearish trending low vol | 2 | -0.23 | -1.15 | 1 | 1 | 50.0 | -0.51 | 76h 00m |
| Sep 2022 | bearish choppy high vol | 2 | +0.26 | 1.41 | 2 | 0 | 100.0 | -0.34 | 0h 00m |
| Aug 2022 | bullish choppy high vol | 1 | +0.14 | 1.41 | 1 | 0 | 100.0 | -0.46 | 0h 00m |
| Mar 2022 | bullish choppy high vol | 1 | -0.29 | -2.95 | 0 | 1 | 0.0 | -0.6 | 8h 00m |
| Feb 2022 | bearish trending high vol | 1 | -0.31 | -3.09 | 0 | 1 | 0.0 | -0.31 | 0h 00m |
| Jan 2022 | bearish trending high vol | 1 | +0.14 | 1.39 | 1 | 0 | 100.0 | 0.0 | 0h 00m |
| Oct 2021 | bullish trending high vol | 1 | +0.26 | 2.56 | 1 | 0 | 100.0 | 0.0 | 20h 00m |
| Aug 2021 | bullish trending high vol | 1 | +0.14 | 1.40 | 1 | 0 | 100.0 | 0.0 | 0h 00m |
| Feb 2021 | bullish trending high vol | 1 | -0.30 | -3.01 | 0 | 1 | 0.0 | 0.0 | 8h 00m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 17 | -0.36 | -0.18 | 9 | 8 | 52.9 | -1.48 | 12h 42m |
| 2024 | 3 | -0.31 | -1.05 | 1 | 2 | 33.3 | -0.92 | 48h 00m |
| 2023 | 9 | +0.67 | 0.79 | 7 | 2 | 77.8 | -0.61 | 7h 07m |
| 2022 | 8 | -0.29 | -0.34 | 5 | 3 | 62.5 | -0.6 | 20h 00m |
| 2021 | 3 | +0.10 | 0.32 | 2 | 1 | 66.7 | 0.0 | 9h 20m |
Trade charts — best 2 and worst 2 performing pairs (full OHLC candles are expensive to render for every pair)
Backtests — over a market period
Backtest this strategy over a chosen crypto-cycle period. These don't affect the League ranking, and need that period's candle data downloaded.
Log in or sign up to run backtests.
| Period | Range | Total % | Win % | Max DD | Trades | |
|---|---|---|---|---|---|---|
| 2020 · DeFi Summer & Pre-Halving Rally | 20200101-20210101 | not run | ||||
| 2021 · Institutional Bull Market | 20210101-20220101 | not run | ||||
| 2022 · Post-Bull Crash & Macro Tightening | 20220101-20230101 | not run | ||||
| 2023–2024 · Recovery & ETF Anticipation | 20230101-20250101 | not run | ||||
| 2025–2026 · Current Cycle | 20250101-20260101 | not run | ||||
Walk forward
Out-of-sample backtest on recent data · 33 pairs · 20260101-20260701.
Backtest trust check
2 potential lookahead pattern(s) found · 1 to review
| Line | Pattern | Detail | |
|---|---|---|---|
| 84 | review | enter_tag_overwrite | enter_tag/exit_tag is written by 5 separate assignments -- they share one column and run in source order, so a row matching more than one condition keeps only the LAST tag. Per-tag statistics won't mean what they appear to |
| 15 | leak | negative_shift | d['swing_high'] = (d['high'] > d['high'].shift(1)) & (d['high'] > d['high'].shift(2)) & (d['high'] >= d['high'].shift(-1 |
| 16 | leak | negative_shift | d['swing_low'] = (d['low'] < d['low'].shift(1)) & (d['low'] < d['low'].shift(2)) & (d['low'] <= d['low'].shift(-1)) & (d |
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.