# source: https://raw.githubusercontent.com/Germoso/ft_userdata/66281ca8373706c6cb2be864e6add352a861d7c5/user_data/strategies/RSI_Strategy.py
from freqtrade.strategy import IStrategy
from pandas import DataFrame
import talib.abstract as ta

class Github_Germoso_ft_userdata__RSI_Strategy__20251118_042238(IStrategy):
    # set the initial stoploss to -10%
    stoploss = -1

    minimal_roi = {"0": 1}

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['rsi'] = ta.RSI(dataframe, timeperiod=7)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe['rsi'] < 30),
            'enter_long'] = 1

        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (dataframe['rsi'] > 70),
            'exit_long'] = 1

        return dataframe