diff --git a/bitmart/交易.py b/bitmart/交易.py index ee12626..aff4d3f 100644 --- a/bitmart/交易.py +++ b/bitmart/交易.py @@ -74,9 +74,9 @@ class BitmartFuturesTransaction: self.take_profit_reentry_quartile = 2 # 止盈后,继续回到 2/4 位置同向再开仓 self.take_profit_min_gain_pct_from_entry = 0.4 # 相对当前K线开盘价的最小涨跌幅阈值(%),超过才允许止盈 self.take_profit_triggered_kline_id = None # 多仓:本K线内是否出现过 open~high 的极值触发 - self.take_profit_reentry_threshold = None # 多仓止盈平仓后,价格 <= 此值则开多(同向) + self.take_profit_reentry_threshold = None # 多仓止盈平仓后,价格 < 此值则开多(同向) self.take_profit_triggered_kline_id_short = None # 空仓:本K线内是否出现过 open~low 的极值触发 - self.take_profit_reentry_threshold_short = None # 空仓止盈平仓后,价格 >= 此值则开空(同向) + self.take_profit_reentry_threshold_short = None # 空仓止盈平仓后,价格 > 此值则开空(同向) self.last_take_profit_kline_id = None # 本K线已止盈一次(不区分多空)则不再止盈 self.optimized_params_file = Path(__file__).resolve().parent / "atr_best_params.json" @@ -750,11 +750,11 @@ class BitmartFuturesTransaction: signal = self.check_signal(current_price, prev_kline, current_kline) else: signal = self.check_signal(current_price, prev_kline, current_kline) - # 3.6 止盈平多后:价格继续回调到 2/4 则同向开多 + # 3.6 止盈平多后:价格继续回调并跌破 2/4 才同向开多 elif self.start == 0 and self.take_profit_reentry_threshold is not None: - if current_price <= self.take_profit_reentry_threshold: + if current_price < self.take_profit_reentry_threshold: reason = ( - f"止盈平仓后价格继续回调至≤{self.take_profit_reentry_threshold:.2f}(2/4),按规则同向开多" + f"止盈平仓后价格继续回调并跌破{self.take_profit_reentry_threshold:.2f}(2/4),按规则同向开多" ) self._log_take_profit_action("止盈后同向开多", reason) self.开单(marketPriceLongOrder=1, size=self.default_order_size) @@ -804,11 +804,11 @@ class BitmartFuturesTransaction: signal = self.check_signal(current_price, prev_kline, current_kline) else: signal = self.check_signal(current_price, prev_kline, current_kline) - # 3.8 止盈平空后:价格继续反弹到 2/4 则同向开空 + # 3.8 止盈平空后:价格继续反弹并突破 2/4 才同向开空 elif self.start == 0 and self.take_profit_reentry_threshold_short is not None: - if current_price >= self.take_profit_reentry_threshold_short: + if current_price > self.take_profit_reentry_threshold_short: reason = ( - f"止盈平空后价格继续反弹至≥{self.take_profit_reentry_threshold_short:.2f}(2/4),按规则同向开空" + f"止盈平空后价格继续反弹并突破{self.take_profit_reentry_threshold_short:.2f}(2/4),按规则同向开空" ) self._log_take_profit_action("止盈后同向开空", reason) self.开单(marketPriceLongOrder=-1, size=self.default_order_size)