From f0ea9a357ac19ef788ea95e9d8f9f277add6a33a Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 13 Sep 2022 13:36:07 +0800 Subject: [PATCH] pivotshort: add one more kline price compare condition --- pkg/strategy/pivotshort/failedbreakhigh.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/pivotshort/failedbreakhigh.go b/pkg/strategy/pivotshort/failedbreakhigh.go index e87aaba3a..07a81ea5c 100644 --- a/pkg/strategy/pivotshort/failedbreakhigh.go +++ b/pkg/strategy/pivotshort/failedbreakhigh.go @@ -150,8 +150,9 @@ func (s *FailedBreakHigh) Bind(session *bbgo.ExchangeSession, orderExecutor *bbg } // the kline opened below the last break low, and closed above the last break low - if k.Open.Compare(s.lastFailedBreakHigh) < 0 && k.Close.Compare(s.lastFailedBreakHigh) > 0 { + if k.Open.Compare(s.lastFailedBreakHigh) < 0 && k.Close.Compare(s.lastFailedBreakHigh) > 0 && k.Open.Compare(k.Close) > 0 { bbgo.Notify("kLine closed above the last break high, triggering stop earlier") + if err := s.orderExecutor.ClosePosition(context.Background(), one, "failedBreakHighStop"); err != nil { log.WithError(err).Error("position close error") }