Merge pull request #524 from frin1/fix/improve-indicators

improved indicators
This commit is contained in:
Yo-An Lin 2022-04-15 15:04:37 +08:00 committed by GitHub
commit d9fd661e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@ var _ types.Series = &AD{}
func (inc *AD) calculateAndUpdate(kLines []types.KLine) { func (inc *AD) calculateAndUpdate(kLines []types.KLine) {
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.Update(k) inc.Update(k)

View File

@ -68,7 +68,7 @@ func (inc *MACD) calculateAndUpdate(kLines []types.KLine) {
var priceF = KLineClosePriceMapper var priceF = KLineClosePriceMapper
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.Update(k, priceF) inc.Update(k, priceF)

View File

@ -50,7 +50,7 @@ func (inc *OBV) calculateAndUpdate(kLines []types.KLine) {
var priceF = KLineClosePriceMapper var priceF = KLineClosePriceMapper
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.Update(k, priceF) inc.Update(k, priceF)

View File

@ -81,7 +81,7 @@ func (inc *RSI) calculateAndUpdate(kLines []types.KLine) {
var priceF = KLineClosePriceMapper var priceF = KLineClosePriceMapper
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.Update(k, priceF) inc.Update(k, priceF)

View File

@ -61,7 +61,7 @@ func (inc *STOCH) calculateAndUpdate(kLines []types.KLine) {
} }
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.update(k) inc.update(k)

View File

@ -74,7 +74,7 @@ func (inc *VWAP) calculateAndUpdate(kLines []types.KLine) {
var priceF = KLineTypicalPriceMapper var priceF = KLineTypicalPriceMapper
for _, k := range kLines { for _, k := range kLines {
if inc.EndTime != zeroTime && k.EndTime.Before(inc.EndTime) { if inc.EndTime != zeroTime && !k.EndTime.After(inc.EndTime) {
continue continue
} }
inc.Update(k, priceF) inc.Update(k, priceF)