💬 Forum

BollingerMR

🏆 League #1305 / 1943

HaroldZhao2025/Trading_Bot/user_data/strategies/BollingerMR.py · ★1 · first seen 2026-07-16 · repo updated 2026-03-11

Basics mode: spot timeframe: 5m
Settings stoploss: -0.08 has minimal roi
Indicators Bollinger_Bands 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 →

 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
from freqtrade.strategy import IStrategy
from pandas import DataFrame
import talib.abstract as ta

class BollingerMR(IStrategy):
    timeframe = "5m"
    minimal_roi = {"0": 0.015}
    stoploss = -0.08

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        bb = ta.BBANDS(dataframe["close"], timeperiod=20, nbdevup=2.0, nbdevdn=2.0, matype=0)

        if isinstance(bb, (list, tuple)) and len(bb) == 3:
            upper, middle, lower = bb[0], bb[1], bb[2]
        else:
            upper, middle, lower = bb["upperband"], bb["middleband"], bb["lowerband"]

        dataframe["bb_upper"] = upper
        dataframe["bb_middle"] = middle
        dataframe["bb_lower"] = lower
        dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["close"] < dataframe["bb_lower"]) & (dataframe["rsi"] < 40),
            "enter_long"
        ] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe["close"] > dataframe["bb_middle"]) | (dataframe["rsi"] > 60),
            "exit_long"
        ] = 1
        return dataframe