pivotshort: add one more kline price compare condition

This commit is contained in:
c9s 2022-09-13 13:36:07 +08:00
parent 0a07a70415
commit f0ea9a357a
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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")
}