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 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement # flake8: noqa: F401 # isort: skip # --- Do not remove these libs --- from functools import reduce from typing import Any, Callable, Dict, List import numpy as np # noqa import pandas as pd # noqa from pandas import DataFrame from freqtrade.strategy import (IStrategy, Trade, CategoricalParameter, DecimalParameter, IntParameter, BooleanParameter) # -------------------------------- # Add your lib to import here import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib class AIAgentStrategy(IStrategy): """ AI Agent Strategy v1.0 — Multi-indicator strategy with adaptive risk. Автор: Hermes AI Agent Назначение: Готовая стратегия для Freqtrade с бэктестами. Рынок: Spot, USDT пары Таймфрейм: 5m Сигналы на покупку: 1. EMA50 выше EMA200 (восходящий тренд) 2. RSI(14) между 30 и 50 (не перекуплен) 3. MACD line выше Signal line 4. Объём выше среднего за 20 свечей Сигналы на продажу: 1. RSI > 70 (перекуплен) 2. MACD line ниже Signal line 3. Take-profit по фиксированному % 4. Stop-loss """ # Strategy interface version INTERFACE_VERSION = 3 # Can this strategy go short? can_short: bool = False # Minimal ROI — агрессивный выход minimal_roi = { "0": 0.08, # 8% — сразу "15": 0.04, # 4% через 15 мин "60": 0.02, # 2% через час "240": 0.01, # 1% через 4 часа "1440": 0 # 0% через сутки } # Stop-loss stoploss = -0.05 # 5% # Trailing stop trailing_stop = True trailing_stop_positive = 0.02 trailing_stop_positive_offset = 0.04 trailing_only_offset_is_reached = True # Run "populate_indicators()" only for new candle process_only_new_candles = True # Number of candles the strategy requires before producing valid signals startup_candle_count: int = 200 # Optional order type mapping order_types = { "entry": "limit", "exit": "limit", "stoploss": "market", "stoploss_on_exchange": False, } # Timeframe timeframe = "5m" # --- Hyperoptable parameters --- # Buy params buy_rsi_lower = IntParameter(25, 45, default=32, space="buy") buy_ema_short = IntParameter(30, 70, default=50, space="buy") buy_ema_long = IntParameter(150, 250, default=200, space="buy") buy_volume_factor = DecimalParameter(1.0, 3.0, default=1.5, decimals=1, space="buy") # Sell params sell_rsi_upper = IntParameter(65, 85, default=72, space="sell") sell_roi_factor = DecimalParameter(0.02, 0.10, default=0.06, decimals=2, space="sell") # --- Indicator Definitions --- def informative_pairs(self): """ Define additional, informative pair/interval combinations to be cached from the exchange. """ return [] def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Adds several different TA indicators to the given DataFrame """ # EMA dataframe["ema_short"] = ta.EMA(dataframe, timeperiod=self.buy_ema_short.value) dataframe["ema_long"] = ta.EMA(dataframe, timeperiod=self.buy_ema_long.value) # RSI dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) # MACD macd = ta.MACD(dataframe) dataframe["macd"] = macd["macd"] dataframe["macdsignal"] = macd["macdsignal"] dataframe["macdhist"] = macd["macdhist"] # Volume SMA dataframe["volume_sma"] = ta.SMA(dataframe["volume"], timeperiod=20) dataframe["volume_mean"] = dataframe["volume"].rolling(window=20).mean() # ATR for volatility dataframe["atr"] = ta.ATR(dataframe, timeperiod=14) # Bollinger Bands bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) dataframe["bb_lowerband"] = bollinger["lower"] dataframe["bb_middleband"] = bollinger["mid"] dataframe["bb_upperband"] = bollinger["upper"] # Additional dataframe["close"] = dataframe["close"] dataframe["volume"] = dataframe["volume"] return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Based on TA indicators, populates the entry signal """ conditions = [] # GUARD: EMA50 > EMA200 (восходящий тренд) conditions.append(dataframe["ema_short"] > dataframe["ema_long"]) # GUARD: RSI между нижней границей и 50 conditions.append(dataframe["rsi"] > self.buy_rsi_lower.value) conditions.append(dataframe["rsi"] < 50) # GUARD: MACD line > Signal line conditions.append(dataframe["macd"] > dataframe["macdsignal"]) # GUARD: Объём выше среднего conditions.append(dataframe["volume"] > dataframe["volume_mean"] * self.buy_volume_factor.value) # GUARD: Цена выше нижней полосы Боллинджера conditions.append(dataframe["close"] > dataframe["bb_lowerband"]) # Combine all conditions if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), "enter_long"] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Based on TA indicators, populates the exit signal """ conditions = [] # EXIT: RSI > верхней границы (перекуплен) conditions.append(dataframe["rsi"] > self.sell_rsi_upper.value) # EXIT: MACD line < Signal line conditions.append(dataframe["macd"] < dataframe["macdsignal"]) # EXIT: Цена выше верхней полосы Боллинджера conditions.append(dataframe["close"] > dataframe["bb_upperband"]) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), "exit_long"] = 1 return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 302.9s
ℹ️ This strategy uses a trailing stop — freqtrade only
re-checks these once per 5m candle by default, not against the price movement within it.
For a more accurate read, re-run this backtest locally with --timeframe-detail 1m. 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=1.00) — hard to tell apart from luck
- only 0% of resampled runs were profitable
- profitable in only 6% of rolling 3-month windows
- did not beat simply holding the market
- very deep drawdown (-91%)
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 |
|---|---|---|---|---|---|---|---|---|---|
| Jun 2022 | bearish trending high vol | 69 | -4.24 | -0.61 | 45 | 24 | 65.2 | -90.77 | 5h 25m |
| May 2022 | bearish trending high vol | 68 | -3.29 | -0.48 | 47 | 21 | 69.1 | -87.72 | 5h 39m |
| Apr 2022 | bearish choppy high vol | 40 | -2.09 | -0.53 | 27 | 13 | 67.5 | -83.67 | 12h 28m |
| Mar 2022 | bullish choppy high vol | 57 | +1.73 | 0.30 | 47 | 10 | 82.5 | -83.55 | 10h 12m |
| Feb 2022 | bearish trending high vol | 58 | +0.81 | 0.14 | 45 | 13 | 77.6 | -84.01 | 6h 55m |
| Jan 2022 | bearish trending high vol | 46 | -2.81 | -0.61 | 31 | 15 | 67.4 | -84.29 | 10h 18m |
| Dec 2021 | bearish trending high vol | 105 | -7.99 | -0.76 | 68 | 37 | 64.8 | -81.45 | 8h 22m |
| Nov 2021 | bullish trending high vol | 108 | -0.98 | -0.09 | 80 | 28 | 74.1 | -74.59 | 8h 34m |
| Oct 2021 | bullish trending high vol | 151 | -5.01 | -0.33 | 111 | 40 | 73.5 | -73.53 | 10h 36m |
| Sep 2021 | bearish trending high vol | 174 | -10.69 | -0.61 | 118 | 56 | 67.8 | -68.75 | 7h 56m |
| Aug 2021 | bullish trending high vol | 199 | -2.77 | -0.14 | 148 | 51 | 74.4 | -58.99 | 8h 15m |
| Jul 2021 | bearish trending high vol | 209 | -8.21 | -0.39 | 148 | 61 | 70.8 | -61.17 | 7h 53m |
| Jun 2021 | bearish trending high vol | 261 | -9.66 | -0.37 | 182 | 79 | 69.7 | -52.28 | 5h 49m |
| May 2021 | bearish trending high vol | 312 | -14.41 | -0.46 | 203 | 109 | 65.1 | -44.4 | 4h 00m |
| Apr 2021 | bearish choppy high vol | 402 | -2.88 | -0.07 | 296 | 106 | 73.6 | -29.26 | 5h 46m |
| Mar 2021 | bullish choppy high vol | 366 | -1.37 | -0.04 | 281 | 85 | 76.8 | -27.56 | 7h 31m |
| Feb 2021 | bullish trending high vol | 409 | -8.79 | -0.22 | 291 | 118 | 71.1 | -23.67 | 4h 20m |
| Jan 2021 | bullish trending high vol | 508 | -7.58 | -0.15 | 361 | 147 | 71.1 | -13.04 | 4h 13m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2022 | 338 | -9.89 | -0.29 | 242 | 96 | 71.6 | -90.77 | 8h 02m |
| 2021 | 3204 | -80.34 | -0.25 | 2287 | 917 | 71.4 | -81.45 | 6h 11m |
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 patterns, but 1 backtest-realism warning(s) — results may not reflect real trading
| Line | Pattern | Detail | |
|---|---|---|---|
| 135 | realism | ohlc_overwrite | overwrites the 'close' candle column -- freqtrade fills at open and checks stop/ROI against high/low, so the backtest uses prices that never traded |
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.