Skip to content

Commit

Permalink
improved indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
frin1 committed Apr 14, 2022
1 parent 88e1384 commit f866787
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/indicator/ad.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/indicator/macd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/indicator/obv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/indicator/rsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/indicator/stoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/indicator/vwap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f866787

Please sign in to comment.