# source: https://raw.githubusercontent.com/h5un/freqtrade-strategies/ff7e2afe6a186f30bfee36ae87428fe8e11a8346/user_data/strategies/test_strategy.py
import talib.abstract as ta
import pandas_ta as pta
from pandas import DataFrame
from technical import qtpylib

from freqtrade.strategy import IStrategy, IntParameter, DecimalParameter, RealParameter

class Github_h5un_freqtrade_strategies__test_strategy__20260112_111946(IStrategy):
    
    INTERFACE_VERSION = 3

    timeframe = '5m'

    can_short: bool = True

    minimal_roi = {
        "0": 1.0
        # empty dict is allowed
    }

    stoploss = -0.99

    trailing_stop = False

    # Run `populate_indicators()` only for new candles.
    process_only_new_candles = True

    use_exit_signal = True # If false, the strategy will only exit by ROI or stoploss
    exit_profit_only = False
    ignore_roi_if_entry_signal = True
    # If true, the bot will ignore ROI if the entry signal is still true

    # Number of candles the strategy requires before producing valid signals
    startup_candle_count: int = 30 

    # Strategy parameters
    buy_rsi = IntParameter(10, 40, default=30, space='buy', optimize=True)

    order_types = {
        'buy': 'limit',
        'sell': 'limit',
        'stoploss': 'market',
        'stoploss_on_exchange': False
    }

    order_time_in_force = {
        'buy': 'GTC', # Good Till Cancelled
        'sell': 'GTC'
    }

    @property
    def plot_config(self):
        return {
            'main_plot': {
                'rsi': {'color': 'blue'},
            },
            'subplots': {
                "MACD": {
                    'macd': {'color': 'blue'},
                    'macdsignal': {'color': 'orange'},
                    'macdhist': {'color': 'green'},
                },
            }
        }
    
    def informative_pairs(self):
        return []
    
    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)


        return dataframe
    
    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

        return dataframe