diff --git a/pkg/indicator/ad.go b/pkg/indicator/ad.go index efbce0673..dd2f4bf5c 100644 --- a/pkg/indicator/ad.go +++ b/pkg/indicator/ad.go @@ -62,7 +62,7 @@ var _ types.Series = &AD{} func (inc *AD) calculateAndUpdate(kLines []types.KLine) { for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.Update(k) diff --git a/pkg/indicator/macd.go b/pkg/indicator/macd.go index 1dc5ad924..ed3e3ba76 100644 --- a/pkg/indicator/macd.go +++ b/pkg/indicator/macd.go @@ -68,7 +68,7 @@ func (inc *MACD) calculateAndUpdate(kLines []types.KLine) { var priceF = KLineClosePriceMapper for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.Update(k, priceF) diff --git a/pkg/indicator/obv.go b/pkg/indicator/obv.go index 164af32db..7f9a28723 100644 --- a/pkg/indicator/obv.go +++ b/pkg/indicator/obv.go @@ -50,7 +50,7 @@ func (inc *OBV) calculateAndUpdate(kLines []types.KLine) { var priceF = KLineClosePriceMapper for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.Update(k, priceF) diff --git a/pkg/indicator/rsi.go b/pkg/indicator/rsi.go index 2fc3b5d8e..3531e2ee9 100644 --- a/pkg/indicator/rsi.go +++ b/pkg/indicator/rsi.go @@ -81,7 +81,7 @@ func (inc *RSI) calculateAndUpdate(kLines []types.KLine) { var priceF = KLineClosePriceMapper for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.Update(k, priceF) diff --git a/pkg/indicator/stoch.go b/pkg/indicator/stoch.go index 9e43e3919..c739f2b46 100644 --- a/pkg/indicator/stoch.go +++ b/pkg/indicator/stoch.go @@ -61,7 +61,7 @@ func (inc *STOCH) calculateAndUpdate(kLines []types.KLine) { } for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.update(k) diff --git a/pkg/indicator/vwap.go b/pkg/indicator/vwap.go index 93ff7ff5b..2ebae069a 100644 --- a/pkg/indicator/vwap.go +++ b/pkg/indicator/vwap.go @@ -74,7 +74,7 @@ func (inc *VWAP) calculateAndUpdate(kLines []types.KLine) { var priceF = KLineTypicalPriceMapper for _, k := range kLines { - if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { + if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) { continue } inc.Update(k, priceF)