💬 Forum

StarterStrategy

🏆 League #1010 / 1939

TradingHostDotCom/freqtrade/strategy.py · first seen 2026-07-16 · repo updated 2026-06-19 · ⬇ 1 download

Basics mode: spot timeframe: 5m interface version: 3
Settings stoploss: -0.1 has minimal roi process only new candles
Indicators EMA RSI talib
15 related strategies ( identical code, similar name)

Each tile is a different kind of check — from an instant code lint to full sandboxed backtests and forward tests on recent data. Not sure what a check actually proves? See the FAQ →

Source

Download Raw
 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
"""Starter Freqtrade strategy.

`main.py` launches Freqtrade against this file via `--strategy StarterStrategy`.
Edit the indicators and entry/exit logic below, or ask your AI tool to build a
new strategy. If you rename the class, update `"strategy"` in config.json.

See .cursor/rules/engine.mdc for indicators, hyperopt, callbacks, and recipes.
"""

import talib.abstract as ta  # bundled with Freqtrade
from freqtrade.strategy import IStrategy
from pandas import DataFrame


class StarterStrategy(IStrategy):
    INTERFACE_VERSION = 3

    timeframe = "5m"
    can_short = False  # set True only for futures trading_mode

    # Hard stop loss (-10%) and a time-based ROI ladder for taking profit.
    stoploss = -0.10
    minimal_roi = {"0": 0.04, "30": 0.02, "60": 0.01}

    # Only act on closed candles.
    process_only_new_candles = True

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
        dataframe["ema_fast"] = ta.EMA(dataframe, timeperiod=20)
        dataframe["ema_slow"] = ta.EMA(dataframe, timeperiod=50)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["rsi"] < 35)
            & (dataframe["ema_fast"] > dataframe["ema_slow"])
            & (dataframe["volume"] > 0),
            "enter_long",
        ] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["rsi"] > 70) & (dataframe["volume"] > 0),
            "exit_long",
        ] = 1
        return dataframe