15 related strategies (⧉ 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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement # flake8: noqa: F401 # isort:skip_file # --- Do not remove these imports --- from datetime import datetime from typing import Optional import numpy as np import pandas as pd from pandas import DataFrame from freqtrade.strategy import IStrategy, IntParameter, DecimalParameter import pandas_ta as ta # --------------------------------------------------------------------------- # Strategy01_EMA_Crossover # --------------------------------------------------------------------------- class Strategy01_EMA_Crossover(IStrategy): """ EMA Crossover Strategy — SPOT ONLY (Halal Algo Trading, Batch 1) ================================================================= Timeframe : 4h Author : Halal Algo Trading Version : 1.0 Overview -------- A trend-following strategy built around a classic triple-EMA framework: • Fast EMA (12-period) — reacts quickly to price momentum • Slow EMA (50-period) — confirms the medium-term trend direction • Trend EMA (200-period) — acts as the primary bull/bear filter A Heikin Ashi candle confirmation is added to reduce false crossovers caused by brief spikes, and a 20-period volume SMA gate prevents entries in low-liquidity environments. Entry Conditions (ALL must be true) ------------------------------------ 1. Fast EMA (12) crosses ABOVE Slow EMA (50) → momentum shift 2. Price (close) is ABOVE the 200 EMA → overall bull market 3. Current candle volume > 20-period volume SMA → confirmed participation 4. Heikin Ashi close > Heikin Ashi open → HA candle is bullish Exit Conditions (ANY triggers exit) ------------------------------------ A. Fast EMA crosses BELOW Slow EMA → momentum reversal B. Price (close) closes BELOW Slow EMA (50) → trend breakdown Risk Management --------------- • Hard stoploss : -10 % • Trailing stop : enabled • Trailing stop positive: 2 % (locks in profit once positive) • ROI ladder : 5 % @ open, 4 % @ 60 min, 3 % @ 120 min, 1 % @ 240 min • SPOT only — no short, no margin, no futures Backtest Reference ------------------ Sharpe 1.30 | Return 491 % | Max DD -34 % | Win Rate 35 % | PF 1.73 """ # ------------------------------------------------------------------------- # Freqtrade metadata # ------------------------------------------------------------------------- INTERFACE_VERSION = 3 # Strategy name shown in logs / hyperopt strategy_name = "Strategy01_EMA_Crossover" # Candle timeframe timeframe = "4h" # Only look at completed (closed) candles process_only_new_candles = True # Startup candle count — need at least 200 candles for the 200 EMA startup_candle_count: int = 210 # ------------------------------------------------------------------------- # ROI — minimal profit targets (time in minutes → target return) # ------------------------------------------------------------------------- minimal_roi = { "0": 0.05, # 5 % immediately "60": 0.04, # 4 % after 60 min "120": 0.03, # 3 % after 120 min "240": 0.01, # 1 % after 240 min } # ------------------------------------------------------------------------- # Stoploss & Trailing Stop # ------------------------------------------------------------------------- stoploss = -0.10 # Hard stoploss: -10 % trailing_stop = True # Enable trailing stop trailing_stop_positive = 0.02 # Trail 2 % once trade is profitable trailing_stop_positive_offset = 0.03 # Only activate trailing after +3 % trailing_only_offset_is_reached = True # ------------------------------------------------------------------------- # Misc # ------------------------------------------------------------------------- # SPOT ONLY — no short positions can_short = False # Use custom sell (exit) signal use_exit_signal = True exit_profit_only = False ignore_roi_if_entry_signal = False # ------------------------------------------------------------------------- # Helper functions # ------------------------------------------------------------------------- @staticmethod def crossed_above(s1: pd.Series, s2: pd.Series) -> pd.Series: """Return True on the bar where s1 crosses from below to above s2.""" return (s1 > s2) & (s1.shift(1) <= s2.shift(1)) @staticmethod def crossed_below(s1: pd.Series, s2: pd.Series) -> pd.Series: """Return True on the bar where s1 crosses from above to below s2.""" return (s1 < s2) & (s1.shift(1) >= s2.shift(1)) # ------------------------------------------------------------------------- # Indicators # ------------------------------------------------------------------------- def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Compute all technical indicators used by entry / exit conditions. Indicators added to `dataframe` -------------------------------- ema_fast — 12-period EMA ema_slow — 50-period EMA ema_trend — 200-period EMA (bull/bear filter) volume_sma — 20-period simple moving average of volume ha_open — Heikin Ashi open ha_close — Heikin Ashi close """ # --- Exponential Moving Averages --- dataframe["ema_fast"] = ta.ema(dataframe["close"], length=12) dataframe["ema_slow"] = ta.ema(dataframe["close"], length=50) dataframe["ema_trend"] = ta.ema(dataframe["close"], length=200) # --- Volume filter: 20-period SMA of volume --- dataframe["volume_sma"] = ta.sma(dataframe["volume"], length=20) # --- Heikin Ashi candles --- # HA Close = (O + H + L + C) / 4 dataframe["ha_close"] = ( dataframe["open"] + dataframe["high"] + dataframe["low"] + dataframe["close"] ) / 4 # HA Open = (prev HA Open + prev HA Close) / 2 ha_open = (dataframe["open"].shift(1) + dataframe["close"].shift(1)) / 2 if len(dataframe) > 0: ha_open.iloc[0] = (dataframe["open"].iloc[0] + dataframe["close"].iloc[0]) / 2 dataframe["ha_open"] = ha_open # --- NaN Safety: convert any None to NaN so pandas comparisons work --- for col in ['ema_fast', 'ema_slow', 'ema_trend', 'volume_sma', 'ha_open', 'ha_close']: dataframe[col] = pd.to_numeric(dataframe[col], errors='coerce') return dataframe # ------------------------------------------------------------------------- # Entry Signal # ------------------------------------------------------------------------- def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Generate LONG entry signals. Conditions (ALL must be true simultaneously): 1. Fast EMA (12) crosses above Slow EMA (50) 2. Price (close) is above 200 EMA → bull trend 3. Volume exceeds its 20-period SMA → liquidity confirmed 4. Heikin Ashi candle is bullish (HA close > HA open) The resulting signal is stored in the `enter_long` column. """ conditions = ( dataframe["ema_fast"].notna() & dataframe["ema_slow"].notna() & dataframe["ema_trend"].notna() & dataframe["volume_sma"].notna() & dataframe["ha_close"].notna() & dataframe["ha_open"].notna() ) dataframe.loc[ conditions & self.crossed_above(dataframe["ema_fast"].fillna(0), dataframe["ema_slow"].fillna(0)) & (dataframe["close"] > dataframe["ema_trend"].fillna(np.inf)) & (dataframe["volume"] > dataframe["volume_sma"].fillna(np.inf)) & (dataframe["ha_close"].fillna(0) > dataframe["ha_open"].fillna(0)), "enter_long", ] = 1 return dataframe # ------------------------------------------------------------------------- # Exit Signal # ------------------------------------------------------------------------- def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Generate LONG exit signals. Exit is triggered when EITHER condition is met: A. Fast EMA (12) crosses below Slow EMA (50) — momentum reversal B. Price (close) closes below Slow EMA (50) — trend breakdown The resulting signal is stored in the `exit_long` column. """ exit_valid = dataframe["ema_fast"].notna() & dataframe["ema_slow"].notna() dataframe.loc[ exit_valid & ( self.crossed_below(dataframe["ema_fast"].fillna(0), dataframe["ema_slow"].fillna(0)) | (dataframe["close"] < dataframe["ema_slow"].fillna(0)) ), "exit_long", ] = 1 return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 16.6s
ℹ️ 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.20) — hard to tell apart from luck
- 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 | 3 | -0.10 | -0.34 | 2 | 1 | 66.7 | -2.94 | 5h 20m |
| Nov 2025 | bearish trending high vol | 8 | +0.11 | 0.13 | 6 | 2 | 75.0 | -2.94 | 9h 00m |
| Oct 2025 | bearish trending low vol | 23 | -0.52 | -0.23 | 16 | 7 | 69.6 | -3.55 | 6h 57m |
| Sep 2025 | bullish choppy low vol | 29 | +1.98 | 0.68 | 25 | 4 | 86.2 | -4.17 | 8h 33m |
| Aug 2025 | bullish choppy low vol | 36 | -0.55 | -0.15 | 28 | 8 | 77.8 | -4.25 | 15h 40m |
| Jul 2025 | bullish choppy low vol | 20 | -0.63 | -0.31 | 13 | 7 | 65.0 | -3.76 | 8h 00m |
| Jun 2025 | bearish choppy low vol | 20 | -0.65 | -0.33 | 15 | 5 | 75.0 | -3.2 | 10h 24m |
| May 2025 | bullish trending low vol | 64 | +1.53 | 0.24 | 52 | 12 | 81.2 | -4.34 | 6h 08m |
| Apr 2025 | bullish choppy low vol | 6 | +0.23 | 0.38 | 5 | 1 | 83.3 | -4.09 | 20h 00m |
| Mar 2025 | bearish trending high vol | 7 | -1.88 | -2.69 | 3 | 4 | 42.9 | -4.18 | 33h 09m |
| Feb 2025 | bearish trending low vol | 7 | -1.79 | -2.56 | 2 | 5 | 28.6 | -2.51 | 20h 34m |
| Jan 2025 | bearish choppy low vol | 34 | +0.78 | 0.23 | 29 | 5 | 85.3 | -1.31 | 12h 35m |
| Dec 2024 | bullish trending low vol | 15 | +0.11 | 0.07 | 11 | 4 | 73.3 | -1.27 | 9h 52m |
| Nov 2024 | bullish trending low vol | 28 | +3.92 | 1.40 | 28 | 0 | 100.0 | -2.54 | 9h 26m |
| Oct 2024 | bullish choppy low vol | 38 | +0.70 | 0.18 | 30 | 8 | 78.9 | -3.99 | 9h 47m |
| Sep 2024 | bearish choppy low vol | 23 | +1.26 | 0.55 | 19 | 4 | 82.6 | -4.82 | 20h 21m |
| Aug 2024 | bearish choppy high vol | 6 | +0.44 | 0.73 | 5 | 1 | 83.3 | -4.89 | 17h 20m |
| Jul 2024 | bearish trending low vol | 15 | -0.69 | -0.46 | 9 | 6 | 60.0 | -4.94 | 14h 40m |
| Jun 2024 | bearish choppy low vol | 12 | -3.61 | -3.01 | 4 | 8 | 33.3 | -4.43 | 13h 20m |
| May 2024 | bullish choppy high vol | 16 | -0.28 | -0.18 | 11 | 5 | 68.8 | -1.11 | 6h 00m |
| Apr 2024 | bearish choppy high vol | 9 | +0.28 | 0.31 | 7 | 2 | 77.8 | -1.4 | 13h 20m |
| Mar 2024 | bullish trending high vol | 23 | -0.79 | -0.35 | 18 | 5 | 78.3 | -1.09 | 5h 44m |
| Feb 2024 | bullish trending low vol | 31 | +1.94 | 0.63 | 26 | 5 | 83.9 | -1.75 | 6h 27m |
| Jan 2024 | bearish choppy high vol | 51 | +0.99 | 0.19 | 40 | 11 | 78.4 | -2.77 | 8h 00m |
| Dec 2023 | bullish trending low vol | 42 | +1.78 | 0.42 | 35 | 7 | 83.3 | -3.0 | 10h 40m |
| Nov 2023 | bullish trending low vol | 29 | -0.59 | -0.20 | 18 | 11 | 62.1 | -3.26 | 9h 14m |
| Oct 2023 | bullish trending low vol | 16 | +2.20 | 1.37 | 15 | 1 | 93.8 | -4.6 | 13h 15m |
| Sep 2023 | bearish choppy low vol | 8 | +0.11 | 0.14 | 7 | 1 | 87.5 | -4.93 | 22h 00m |
| Aug 2023 | bearish choppy low vol | 14 | -0.60 | -0.43 | 10 | 4 | 71.4 | -4.68 | 15h 09m |
| Jul 2023 | bullish trending low vol | 39 | +1.54 | 0.39 | 32 | 7 | 82.1 | -5.33 | 6h 58m |
| Jun 2023 | bullish trending low vol | 8 | +0.80 | 1.00 | 8 | 0 | 100.0 | -6.2 | 22h 00m |
| May 2023 | bearish choppy low vol | 8 | -1.44 | -1.80 | 3 | 5 | 37.5 | -6.3 | 22h 00m |
| Apr 2023 | bullish trending low vol | 35 | -1.28 | -0.37 | 23 | 12 | 65.7 | -4.96 | 9h 57m |
| Mar 2023 | bullish trending high vol | 24 | -0.35 | -0.14 | 17 | 7 | 70.8 | -4.13 | 10h 10m |
| Feb 2023 | bullish trending low vol | 40 | -1.24 | -0.31 | 30 | 10 | 75.0 | -3.46 | 10h 36m |
| Jan 2023 | bullish trending low vol | 7 | +0.63 | 0.89 | 7 | 0 | 100.0 | -1.5 | 2h 51m |
| Dec 2022 | bearish trending low vol | 4 | -0.28 | -0.70 | 3 | 1 | 75.0 | -1.85 | 10h 00m |
| Nov 2022 | bearish trending high vol | 17 | +2.47 | 1.45 | 17 | 0 | 100.0 | -3.15 | 4h 56m |
| Oct 2022 | bullish choppy low vol | 16 | +0.19 | 0.12 | 13 | 3 | 81.2 | -4.18 | 13h 30m |
| Sep 2022 | bearish choppy high vol | 18 | -3.11 | -1.73 | 12 | 6 | 66.7 | -3.89 | 9h 20m |
| Aug 2022 | bullish choppy high vol | 19 | -0.73 | -0.39 | 13 | 6 | 68.4 | -1.66 | 6h 57m |
| Jul 2022 | bearish trending high vol | 26 | +4.33 | 1.66 | 26 | 0 | 100.0 | -2.95 | 4h 18m |
| Jun 2022 | bearish trending high vol | 3 | -0.03 | -0.10 | 1 | 2 | 33.3 | -3.33 | 6h 40m |
| May 2022 | bearish trending high vol | 4 | +0.38 | 0.96 | 4 | 0 | 100.0 | -3.3 | 7h 00m |
| Apr 2022 | bearish choppy high vol | 14 | -1.26 | -0.90 | 8 | 6 | 57.1 | -3.72 | 5h 26m |
| Mar 2022 | bullish choppy high vol | 11 | -0.44 | -0.40 | 7 | 4 | 63.6 | -2.86 | 9h 27m |
| Feb 2022 | bearish trending high vol | 7 | +0.16 | 0.22 | 5 | 2 | 71.4 | -2.71 | 4h 34m |
| Jan 2022 | bearish trending high vol | 8 | -1.41 | -1.77 | 5 | 3 | 62.5 | -1.91 | 14h 30m |
| Dec 2021 | bearish trending high vol | 11 | +1.54 | 1.40 | 9 | 2 | 81.8 | -0.69 | 3h 16m |
| Nov 2021 | bullish trending high vol | 34 | +2.35 | 0.69 | 29 | 5 | 85.3 | -2.72 | 6h 14m |
| Oct 2021 | bullish trending high vol | 39 | +1.53 | 0.39 | 35 | 4 | 89.7 | -3.5 | 7h 17m |
| Sep 2021 | bearish trending high vol | 23 | -0.49 | -0.21 | 19 | 4 | 82.6 | -3.58 | 12h 52m |
| Aug 2021 | bullish trending high vol | 17 | +2.05 | 1.21 | 16 | 1 | 94.1 | -4.6 | 5h 39m |
| Jul 2021 | bearish trending high vol | 6 | +0.53 | 0.89 | 5 | 1 | 83.3 | -5.19 | 6h 40m |
| Jun 2021 | bearish trending high vol | 2 | +1.00 | 5.00 | 2 | 0 | 100.0 | -6.09 | 0h 00m |
| May 2021 | bearish trending high vol | 22 | -5.66 | -2.58 | 14 | 8 | 63.6 | -6.58 | 6h 11m |
| Apr 2021 | bearish choppy high vol | 26 | +1.23 | 0.47 | 21 | 5 | 80.8 | -3.04 | 6h 18m |
| Mar 2021 | bullish choppy high vol | 46 | +2.67 | 0.58 | 38 | 8 | 82.6 | -5.16 | 6h 57m |
| Feb 2021 | bullish trending high vol | 10 | -2.21 | -2.21 | 6 | 4 | 60.0 | -4.65 | 4h 48m |
| Jan 2021 | bullish trending high vol | 23 | +0.20 | 0.09 | 17 | 6 | 73.9 | -2.96 | 3h 50m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 257 | -1.49 | -0.06 | 196 | 61 | 76.3 | -4.34 | 10h 41m |
| 2024 | 267 | +4.27 | 0.16 | 208 | 59 | 77.9 | -4.94 | 10h 05m |
| 2023 | 270 | +1.56 | 0.06 | 205 | 65 | 75.9 | -6.3 | 11h 01m |
| 2022 | 147 | +0.27 | 0.02 | 114 | 33 | 77.6 | -4.18 | 7h 40m |
| 2021 | 259 | +4.74 | 0.18 | 211 | 48 | 81.5 | -6.58 | 6h 38m |
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
no lookahead-bias patterns detected
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.