mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
pivotshort: add one more kline price compare condition
This commit is contained in:
parent
0a07a70415
commit
f0ea9a357a
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user