Skip to content

Commit 9a11fd5

Browse files
committed
pivotshort: fix open close price compare
1 parent 178913d commit 9a11fd5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/strategy/pivotshort/breaklow.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,20 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
9494

9595
openPrice := kline.Open
9696
closePrice := kline.Close
97+
9798
// if previous low is not break, skip
9899
if closePrice.Compare(breakPrice) >= 0 {
99100
return
100101
}
101102

102103
// we need the price cross the break line or we do nothing
103104
if !(openPrice.Compare(breakPrice) > 0 && closePrice.Compare(breakPrice) < 0) {
105+
log.Infof("%s kline is not between the break low price %f", kline.Symbol, breakPrice.Float64())
104106
return
105107
}
106108

107109
// force direction to be down
108-
if closePrice.Compare(openPrice) > 0 {
110+
if closePrice.Compare(openPrice) >= 0 {
109111
log.Infof("%s price %f is closed higher than the open price %f, skip this break", kline.Symbol, closePrice.Float64(), openPrice.Float64())
110112
// skip UP klines
111113
return

0 commit comments

Comments
 (0)