# source: https://raw.githubusercontent.com/DerSalvador/freqtrade-helm-chart/a669dc11b640b0eb63aa8f8b51e9f181fd7ee43c/chart/deployed_strategies/TechnicalExampleStrategy.py
from pandas import DataFrame
from technical.indicators import cmf
from freqtrade.strategy.interface import IStrategy

class Github_DerSalvador_freqtrade_helm_chart__TechnicalExampleStrategy__20260115_122204(IStrategy):
    INTERFACE_VERSION = 3
    minimal_roi = {'0': 0.01}
    stoploss = -0.05
    # Optimal timeframe for the strategy
    timeframe = '5m'

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['cmf'] = cmf(dataframe, 21)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[dataframe['cmf'] < 0, 'enter_long'] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        # different strategy used for exit points, due to be able to duplicate it to 100%
        dataframe.loc[dataframe['cmf'] > 0, 'exit_long'] = 1
        return dataframe