diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index 4c707ad..94b94ca 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -295,19 +295,19 @@ class FreqaiExampleStrategy(IStrategy): return dataframe - def populate_exit_trend(self, df: DataFrame, metadata: dict) -> DataFrame: + def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # 改进卖出信号条件 exit_long_conditions = [ - (df["rsi"] > df["sell_rsi_pred"]), # RSI 高于卖出阈值 - (df["volume"] > df["volume"].rolling(window=10).mean()), # 成交量高于近期均值 - (df["close"] < df["bb_middleband"]) # 价格低于布林带中轨 + (dataframe["rsi"] > dataframe["sell_rsi_pred"]), # RSI 高于卖出阈值 + (dataframe["volume"] > dataframe["volume"].rolling(window=10).mean()), # 成交量高于近期均值 + (dataframe["close"] < dataframe["bb_middleband"]) # 价格低于布林带中轨 ] if exit_long_conditions: - df.loc[ + dataframe.loc[ reduce(lambda x, y: x & y, exit_long_conditions), "exit_long" ] = 1 - return df + return dataframe def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame: # 改进买入信号条件 # 检查 MACD 列是否存在