diff --git a/pkg/bbgo/exit_protective_stop_loss.go b/pkg/bbgo/exit_protective_stop_loss.go index fbba25768..3d6d9d78e 100644 --- a/pkg/bbgo/exit_protective_stop_loss.go +++ b/pkg/bbgo/exit_protective_stop_loss.go @@ -123,18 +123,14 @@ func (s *ProtectiveStopLoss) Bind(session *ExchangeSession, orderExecutor *Gener }) position := orderExecutor.Position() - session.MarketDataStream.OnKLineClosed(func(kline types.KLine) { - if kline.Symbol != position.Symbol || kline.Interval != types.Interval1m { - return - } - + session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, types.Interval1m, func(kline types.KLine) { isPositionOpened := !position.IsClosed() && !position.IsDust(kline.Close) if isPositionOpened { s.handleChange(context.Background(), position, kline.Close, s.orderExecutor) } else { s.stopLossPrice = fixedpoint.Zero } - }) + })) if !IsBackTesting && enableMarketTradeStop { session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {