SimpleRSI_Shorts
♡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 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement # flake8: noqa: F401 # isort: skip_file # --- Do not remove these libs --- from warnings import simplefilter import numpy as np # noqa import pandas as pd # noqa from pandas import DataFrame from functools import reduce from typing import Dict, List from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalParameter, IStrategy, IntParameter) from freqtrade.persistence import Trade from datetime import datetime # -------------------------------- import talib.abstract as ta import warnings warnings.filterwarnings( 'ignore', message='The objective has been evaluated at this point before.') simplefilter(action="ignore", category=pd.errors.PerformanceWarning) class SimpleRSI_Shorts(IStrategy): """ SimpleRSI_Shorts - Shorts-only variant of SimpleRSI. Original enters long when RSI crosses above minRSI (default 80) - momentum breakout. This shorts variant enters short when RSI crosses below (100 - minRSI) = 20 - momentum breakdown. Same ROI, stoploss, and leverage as longs with only trading logic inverted. """ can_short: bool = True INTERFACE_VERSION = 3 rsiWindow = IntParameter(7, 21, default=14, space="buy", optimize=True) # Inverted: 100 - 80 = 20 (enter short when RSI drops into oversold) minRSI = DecimalParameter(1, 99, decimals=0, default=20, space="buy", optimize=True) use_custom_stoploss: bool = True process_only_new_candles: bool = True position_adjustment_enable: bool = False # Same as longs minimal_roi = { "0": 500.0 } stoploss = -0.99 trailing_stop = False timeframe = '1d' startup_candle_count: int = 50 # Max short trades max_short_trades = 4 order_types = { 'entry': 'market', 'exit': 'market', 'stoploss': 'market', 'stoploss_on_exchange': False } order_time_in_force = { 'entry': 'gtc', 'exit': 'gtc' } def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: # Emergency backstop: prevent liquidation at 3x leverage if current_profit <= -0.20: return -0.21 return 1 def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, current_time: datetime, entry_tag: str, side: str, **kwargs) -> bool: # Only allow shorts if side == "long": return False # Enforce max short positions short_count = sum(1 for t in Trade.get_trades_proxy(is_open=True) if t.is_short) if short_count >= self.max_short_trades: return False return True def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe['RSI'] = ta.RSI(dataframe, timeperiod=int(self.rsiWindow.value)) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # Inverted: enter short when RSI drops below threshold from above conditions = [] conditions.append(dataframe['RSI'] <= self.minRSI.value) conditions.append(dataframe['RSI'].shift(1) > self.minRSI.value) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'enter_short'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions = [] conditions.append(dataframe['RSI'] <= -5) # never exits if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'exit_short'] = 1 return dataframe def leverage(self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: str, side: str, **kwargs) -> float: return 3.0 @property def protections(self): return [ { "method": "CooldownPeriod", "stop_duration": 10080 } ] |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 10.9s
ℹ️ This strategy uses custom_stoploss() — freqtrade only
re-checks these once per 1d 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 →
Loading charts…
Monthly breakdown
| Month | Regime | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|---|
| Aug 2024 | bearish choppy high vol | 1 | -4.32 | -43.32 | 0 | 1 | 0.0 | -26.14 | 48h 00m |
| Jul 2024 | bearish trending low vol | 1 | -4.00 | -40.08 | 0 | 1 | 0.0 | -21.68 | 2472h 00m |
| Nov 2023 | bullish trending low vol | 2 | -8.46 | -42.43 | 0 | 2 | 0.0 | -17.56 | 2904h 00m |
| Oct 2023 | bullish trending low vol | 2 | -8.58 | -42.95 | 0 | 2 | 0.0 | -8.84 | 1596h 00m |
| Jun 2022 | bearish trending high vol | 1 | -2.94 | -29.51 | 0 | 1 | 0.0 | 0.0 | 72h 00m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2024 | 2 | -8.32 | -41.70 | 0 | 2 | 0.0 | -26.14 | 1260h 00m |
| 2023 | 4 | -17.04 | -42.69 | 0 | 4 | 0.0 | -17.56 | 2250h 00m |
| 2022 | 1 | -2.94 | -29.51 | 0 | 1 | 0.0 | 0.0 | 72h 00m |
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.