ema20,50相关入场条件调整
This commit is contained in:
parent
0366e692ea
commit
0125e3481e
@ -845,8 +845,7 @@ class FreqaiPrimer(IStrategy):
|
||||
dataframe["ema50"] = ta.EMA(dataframe, timeperiod=50)
|
||||
dataframe["ema20"] = ta.EMA(dataframe, timeperiod=20)
|
||||
price_below_ema50 = dataframe["close"] < dataframe["ema50"]
|
||||
price_above_ema50 = dataframe["close"] > dataframe["ema50"]
|
||||
price_below_ema20 = dataframe["close"] < dataframe["ema20"]
|
||||
price_above_ema20 = dataframe["close"] > dataframe["ema20"]
|
||||
|
||||
# 动态调整成交量和 RSI 阈值
|
||||
volume_z_score_min = 0.5
|
||||
@ -921,7 +920,7 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f"[{pair}] 🚀 牛市正常通道:持仓{open_trades}>2个,75USDT入场,必须满足全部7个条件")
|
||||
|
||||
elif trend_status == "bearish":
|
||||
# 下跌趋势:严格入场条件,只抄底,且价格必须高于EMA50
|
||||
# 下跌趋势:严格入场条件,只抄底,且价格必须高于EMA20
|
||||
cond1 = (dataframe["&-price_value_divergence"] < self.buy_threshold * 0.7) # 严格到0.7倍
|
||||
cond2 = (dataframe["volume_z_score"] > volume_z_score_threshold * 1.3) # 提高成交量要求
|
||||
cond3 = (dataframe["rsi"] < rsi_threshold * 0.8) # 严格RSI要求
|
||||
@ -929,11 +928,11 @@ class FreqaiPrimer(IStrategy):
|
||||
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold * 0.8) # 严格STOCHRSI要求
|
||||
cond6 = ~bearish_signal_aligned # 保持熊市过滤
|
||||
cond7 = ~stochrsi_overbought_aligned # 保持超买过滤
|
||||
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_above_ema50 & ~is_unstable_region
|
||||
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_above_ema20 & ~is_unstable_region
|
||||
logger.info(f"[{pair}] 📉 下跌趋势策略:严格入场条件")
|
||||
|
||||
else: # ranging
|
||||
# 震荡趋势:close必须低于ema20,且高于ema50
|
||||
# 震荡趋势:close必须低于ema50
|
||||
cond1 = (dataframe["&-price_value_divergence"] < self.buy_threshold)
|
||||
cond2 = (dataframe["volume_z_score"] > volume_z_score_threshold)
|
||||
cond3 = (dataframe["rsi"] < rsi_threshold)
|
||||
@ -941,7 +940,7 @@ class FreqaiPrimer(IStrategy):
|
||||
cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold)
|
||||
cond6 = ~bearish_signal_aligned
|
||||
cond7 = ~stochrsi_overbought_aligned
|
||||
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_below_ema20 & price_above_ema50 & ~is_unstable_region
|
||||
buy_condition = cond1 & cond2 & cond3 & cond4 & cond5 & cond6 & cond7 & price_below_ema50 & ~is_unstable_region
|
||||
logger.info(f"[{pair}] ⚖️ 震荡趋势策略:close必须低于ema20,且高于ema50")
|
||||
|
||||
# 绿色通道和趋势状态的条件已经设置好buy_condition
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user