mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
Merge pull request #524 from frin1/fix/improve-indicators
improved indicators
This commit is contained in:
commit
d9fd661e1b
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user