💬 Forum

BreakoutStrategy

GwakJunwoo/binance_trader/binance_trader_pro/integrations/freqtrade/user_data/strategies/breakout.py · first seen 2026-07-16 · repo updated 2025-07-27

Basics mode: futures timeframe: 1h
Settings stoploss: -0.09 has minimal roi
Concepts breakout
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
# -*- coding: utf-8 -*-
from typing import Dict, Any
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
import numpy as np

class BreakoutStrategy(IStrategy):
    timeframe = "1h"
    can_short = True
    minimal_roi = {0: 0.03}
    stoploss = -0.09

    def populate_indicators(self, df: DataFrame, metadata: Dict[str, Any]) -> DataFrame:
        df["high_max"] = df["high"].rolling(20).max()
        df["low_min"]  = df["low"].rolling(20).min()
        tr = np.maximum(df["high"]-df["low"], np.maximum(abs(df["high"]-df["close"].shift(1)), abs(df["low"]-df["close"].shift(1))))
        df["atr"] = tr.rolling(14).mean()
        return df

    def populate_entry_trend(self, df: DataFrame, metadata: Dict[str, Any]) -> DataFrame:
        df.loc[df["close"] > df["high_max"], "enter_long"] = 1
        df.loc[df["close"] < df["low_min"],  "enter_short"] = 1
        return df

    def populate_exit_trend(self, df: DataFrame, metadata: Dict[str, Any]) -> DataFrame:
        df["exit_long"] = 0
        df["exit_short"] = 0
        return df

    # def leverage(self, pair: str, current_rate: float, proposed_leverage: float = 1.0, **kwargs) -> float:
    #     return 2.0