Basics
mode: spot
timeframe: 1d
Settings
stoploss: -0.99
protections
process only new candles
startup candle count: 300
hyperopt
hyperopt params: 5
Indicators
ATR
EMA
talib
Concepts
risk_management
Methods
custom_exit
protections
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 | ############################################################################################################# ## MACD-V Strategy by @zxjason ## ## https://github.com/zxjason/Freqtrade_Strategies ## ## Strategy for Freqtrade https://github.com/freqtrade/freqtrade ## ############################################################################################################# ## GENERAL RECOMMENDATIONS ## ## For optimal performance, suggested to use only BTC and ETH. ## ############################################################################################################# ## DONATIONS ## ## usdc: 0xedB85Ce16ba8268F32925f6fF48190Cea97a9b81 ## ## REFERRAL LINKS ## ############################################################################################################# from freqtrade.strategy import IStrategy, merge_informative_pair from freqtrade.strategy import DecimalParameter, IntParameter from pandas import DataFrame import talib.abstract as ta import numpy as np class MACDVStrategy(IStrategy): # 策略参数 stoploss = -0.99 # 禁用止损 timeframe = '1d' # 参数设置 ema_period = IntParameter(200, 200, default=200, space='buy') exit_profit_pct = DecimalParameter(0.0285, 0.0285, default=0.0285, space='sell') macdv_threshold = IntParameter(70, 70, default=70, space='buy') # 时间相关退出参数 exit_after_days_profit = IntParameter(15, 15, default=15, space='sell') exit_after_days = IntParameter(77, 77, default=77, space='sell') # 策略配置 startup_candle_count = 300 # 确保足够计算EMA200 process_only_new_candles = True use_exit_signal = True ignore_roi_if_entry_signal = False def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # 计算EMA200 dataframe['ema200'] = ta.EMA(dataframe, timeperiod=self.ema_period.value) # 计算MACD-V指标 fast_len = 12 slow_len = 26 atr_len = 26 signal_len = 9 # 计算EMA快慢线 ema_fast = ta.EMA(dataframe, timeperiod=fast_len) ema_slow = ta.EMA(dataframe, timeperiod=slow_len) # 计算ATR dataframe['atr'] = ta.ATR(dataframe, timeperiod=atr_len) # 计算MACD-V dataframe['macd'] = ((ema_fast - ema_slow) / dataframe['atr']) * 100 dataframe['signal'] = ta.EMA(dataframe['macd'], timeperiod=signal_len) dataframe['hist'] = dataframe['macd'] - dataframe['signal'] return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # 多头入场条件 dataframe.loc[ ( (dataframe['close'] > dataframe['ema200']) & # 价格在EMA200上方 (dataframe['macd'] > self.macdv_threshold.value) & # MACD-V超过70 (dataframe['volume'] > 0) # 确保有成交量 ), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # 初始化所有退出信号为0 dataframe['exit_signal'] = 0 # 条件1:达到目标利润2.85% dataframe.loc[ (dataframe['close'] >= dataframe['open'] * (1 + self.exit_profit_pct.value)), 'exit_signal' ] = 1 # 条件2:MACD-V下穿信号线 dataframe.loc[ (dataframe['macd'] < dataframe['signal']) & (dataframe['macd'].shift(1) >= dataframe['signal'].shift(1)), 'exit_signal' ] = 1 # 合并退出条件 dataframe.loc[ (dataframe['exit_signal'] == 1), 'exit_long' ] = 1 return dataframe def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs): # 基于时间的退出条件 if (current_time - trade.open_date_utc).days >= self.exit_after_days.value: return 'time_exit_77_days' if current_profit > 0 and (current_time - trade.open_date_utc).days >= self.exit_after_days_profit.value: return 'time_exit_15_days_profit' return None # 风险管理设置 @property def protections(self): return [ { "method": "CooldownPeriod", "stop_duration_candles": 3 } ] |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 14.1s
pairs 33 pairs
timerange 20210101-20260101
mode spot
timeframe 1d
stake 100 USDT
wallet 1000 USDT
max open trades 10
fee exchange lowest tier
total profit+293.26%
final wallet3933 USDT
win rate47.7%
max drawdown-12.06%
market change+403.38%
vs market-110.12%
timeframe1d
profit factor2.29
expectancy ratio0.676
break-even fee3.3215%
sharpe1.039
sortino4.48
CAGR+31.5%
calmar25.452
avg MFE+24.21%
avg MAE-13.11%
avg profit/trade6.44%
avg duration280h 46m
best trade+223.32%
worst trade-40.04%
win/loss streak12 / 15
positive months21/51
consistent (3-mo)57.1%
worst 3-mo-13.98%
trades455
revision1
likely annual return+32%
range (5th–95th)+20% … +48%
chance of profit100.0%
worst-5% outcome+18%
significance (p)0.0005
risk of ruin0.0%
- did not beat simply holding the market
- statistically significant edge (p=0.00)
- 100% of resampled runs stayed profitable
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 |
|---|---|---|---|---|---|---|---|---|---|
| Nov 2025 | bearish trending high vol | 2 | -5.07 | -25.35 | 0 | 2 | 0.0 | -5.57 | 168h 00m |
| Oct 2025 | bearish trending low vol | 5 | +6.14 | 12.23 | 1 | 4 | 20.0 | -6.77 | 240h 00m |
| Sep 2025 | bullish choppy low vol | 9 | -0.86 | -0.95 | 5 | 4 | 55.6 | -6.16 | 304h 00m |
| Aug 2025 | bullish choppy low vol | 17 | -5.50 | -3.24 | 6 | 11 | 35.3 | -6.1 | 208h 56m |
| Jul 2025 | bullish choppy low vol | 11 | +9.07 | 8.25 | 10 | 1 | 90.9 | -6.71 | 340h 22m |
| Jun 2025 | bearish choppy low vol | 9 | -6.45 | -7.17 | 3 | 6 | 33.3 | -6.47 | 266h 40m |
| May 2025 | bullish trending low vol | 16 | -1.21 | -0.76 | 5 | 11 | 31.2 | -4.94 | 204h 00m |
| Apr 2025 | bullish choppy low vol | 1 | -0.45 | -4.50 | 0 | 1 | 0.0 | -4.63 | 96h 00m |
| Feb 2025 | bearish trending low vol | 1 | -1.81 | -18.15 | 0 | 1 | 0.0 | -4.52 | 408h 00m |
| Jan 2025 | bearish choppy low vol | 3 | -2.81 | -9.38 | 0 | 3 | 0.0 | -4.09 | 272h 00m |
| Dec 2024 | bullish trending low vol | 25 | +18.45 | 7.36 | 10 | 15 | 40.0 | -3.41 | 274h 34m |
| Nov 2024 | bullish trending low vol | 14 | +21.48 | 15.35 | 10 | 4 | 71.4 | -3.92 | 300h 00m |
| Oct 2024 | bullish choppy low vol | 17 | -5.72 | -3.37 | 3 | 14 | 17.6 | -4.69 | 179h 18m |
| Sep 2024 | bearish choppy low vol | 2 | -0.06 | -0.29 | 1 | 1 | 50.0 | -2.56 | 360h 00m |
| Aug 2024 | bearish choppy high vol | 3 | -3.13 | -10.42 | 0 | 3 | 0.0 | -2.54 | 504h 00m |
| Jul 2024 | bearish trending low vol | 2 | -1.10 | -5.48 | 1 | 1 | 50.0 | -1.96 | 732h 00m |
| Jun 2024 | bearish choppy low vol | 3 | -2.77 | -9.25 | 0 | 3 | 0.0 | -1.42 | 304h 00m |
| May 2024 | bullish choppy high vol | 1 | -0.36 | -3.64 | 0 | 1 | 0.0 | -0.69 | 144h 00m |
| Apr 2024 | bearish choppy high vol | 9 | +1.06 | 1.18 | 5 | 4 | 55.6 | -1.62 | 285h 20m |
| Mar 2024 | bullish trending high vol | 21 | +36.34 | 17.31 | 14 | 7 | 66.7 | -1.27 | 315h 26m |
| Feb 2024 | bullish trending low vol | 5 | +2.31 | 4.62 | 3 | 2 | 60.0 | -2.25 | 264h 00m |
| Jan 2024 | bearish choppy high vol | 19 | -8.04 | -4.23 | 7 | 12 | 36.8 | -2.56 | 257h 41m |
| Dec 2023 | bullish trending low vol | 23 | +44.69 | 19.42 | 15 | 8 | 65.2 | -0.42 | 299h 29m |
| Nov 2023 | bullish trending low vol | 20 | +30.48 | 15.23 | 17 | 3 | 85.0 | -8.81 | 337h 12m |
| Oct 2023 | bullish trending low vol | 6 | -1.00 | -1.66 | 3 | 3 | 50.0 | -9.42 | 252h 00m |
| Aug 2023 | bearish choppy low vol | 10 | -4.39 | -4.39 | 2 | 8 | 20.0 | -9.04 | 312h 00m |
| Jul 2023 | bullish trending low vol | 14 | +10.69 | 7.63 | 7 | 7 | 50.0 | -12.02 | 300h 00m |
| Jun 2023 | bullish trending low vol | 2 | -2.23 | -11.14 | 0 | 2 | 0.0 | -11.17 | 900h 00m |
| May 2023 | bearish choppy low vol | 1 | +1.33 | 13.25 | 1 | 0 | 100.0 | -10.41 | 288h 00m |
| Apr 2023 | bullish trending low vol | 6 | +3.51 | 5.84 | 4 | 2 | 66.7 | -11.89 | 396h 00m |
| Mar 2023 | bullish trending high vol | 4 | -4.32 | -10.79 | 0 | 4 | 0.0 | -12.04 | 396h 00m |
| Feb 2023 | bullish trending low vol | 18 | +4.28 | 2.38 | 9 | 9 | 50.0 | -11.73 | 278h 40m |
| Jan 2023 | bullish trending low vol | 8 | -1.65 | -2.06 | 3 | 5 | 37.5 | -12.06 | 195h 00m |
| Dec 2022 | bearish trending low vol | 1 | -1.68 | -16.84 | 0 | 1 | 0.0 | -11.48 | 624h 00m |
| Nov 2022 | bearish trending high vol | 4 | -8.34 | -20.85 | 0 | 4 | 0.0 | -10.91 | 162h 00m |
| Oct 2022 | bullish choppy low vol | 2 | -1.50 | -7.48 | 0 | 2 | 0.0 | -8.09 | 276h 00m |
| Sep 2022 | bearish choppy high vol | 1 | -0.70 | -7.01 | 0 | 1 | 0.0 | -7.59 | 120h 00m |
| Aug 2022 | bullish choppy high vol | 4 | -3.42 | -8.56 | 1 | 3 | 25.0 | -7.35 | 270h 00m |
| May 2022 | bearish trending high vol | 1 | -0.81 | -8.09 | 0 | 1 | 0.0 | -6.2 | 72h 00m |
| Apr 2022 | bearish choppy high vol | 10 | -7.83 | -7.83 | 1 | 9 | 10.0 | -6.48 | 211h 12m |
| Jan 2022 | bearish trending high vol | 4 | -4.56 | -11.50 | 2 | 2 | 50.0 | -3.28 | 252h 00m |
| Dec 2021 | bearish trending high vol | 1 | -1.59 | -16.01 | 0 | 1 | 0.0 | -1.74 | 192h 00m |
| Nov 2021 | bullish trending high vol | 14 | +0.65 | 0.46 | 6 | 8 | 42.9 | -2.22 | 282h 51m |
| Oct 2021 | bullish trending high vol | 4 | -0.51 | -1.29 | 1 | 3 | 25.0 | -0.53 | 168h 00m |
| Sep 2021 | bearish trending high vol | 23 | +17.84 | 7.76 | 12 | 11 | 52.2 | -2.17 | 236h 52m |
| Aug 2021 | bullish trending high vol | 13 | +43.10 | 33.15 | 11 | 2 | 84.6 | -2.57 | 315h 42m |
| May 2021 | bearish trending high vol | 15 | +21.94 | 14.66 | 7 | 8 | 46.7 | -3.11 | 256h 00m |
| Apr 2021 | bearish choppy high vol | 12 | +28.00 | 23.34 | 7 | 5 | 58.3 | -1.93 | 302h 00m |
| Mar 2021 | bullish choppy high vol | 10 | +5.09 | 5.08 | 5 | 5 | 50.0 | -3.73 | 295h 12m |
| Feb 2021 | bullish trending high vol | 16 | +65.33 | 40.81 | 12 | 4 | 75.0 | -2.44 | 318h 00m |
| Jan 2021 | bullish trending high vol | 13 | +11.41 | 8.78 | 7 | 6 | 53.8 | -3.49 | 288h 00m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 74 | -8.95 | -1.21 | 30 | 44 | 40.5 | -6.77 | 250h 42m |
| 2024 | 121 | +58.46 | 4.83 | 54 | 67 | 44.6 | -4.69 | 283h 15m |
| 2023 | 112 | +81.39 | 7.26 | 61 | 51 | 54.5 | -12.06 | 313h 17m |
| 2022 | 27 | -28.84 | -10.70 | 4 | 23 | 14.8 | -11.48 | 230h 13m |
| 2021 | 121 | +191.26 | 15.81 | 68 | 53 | 56.2 | -3.73 | 277h 53m |
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 logsno lookahead bias detected
20 signal(s) analysed · 0 biased entries · 0 biased exits
ran by Ron · took 7.9s