pivotshort: add one more kline pattern to check the break

This commit is contained in:
c9s 2022-09-14 19:08:21 +08:00
parent 3ab5d35b77
commit 728cb6d56c
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -186,8 +186,11 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
}
// we need the price cross the break line, or we do nothing:
// open > break price > close price
if !(openPrice.Compare(breakPrice) > 0 && closePrice.Compare(breakPrice) < 0) {
// 1) open > break price > close price
// 2) high > break price > open price and close price
// v2
if !((openPrice.Compare(breakPrice) > 0 && closePrice.Compare(breakPrice) < 0) ||
(kline.High.Compare(breakPrice) > 0 && openPrice.Compare(breakPrice) < 0 && closePrice.Compare(breakPrice) < 0)) {
return
}