fix: fix pivothigh indicator use high instead of low

This commit is contained in:
c9s 2022-09-06 23:39:13 +08:00
parent 78299a6e7d
commit f62eb301e3
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -43,13 +43,13 @@ func (inc *PivotHigh) Update(value float64) {
return return
} }
low, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow) high, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow)
if !ok { if !ok {
return return
} }
if low > 0.0 { if high > 0.0 {
inc.Values.Push(low) inc.Values.Push(high)
} }
} }
@ -58,8 +58,7 @@ func (inc *PivotHigh) PushK(k types.KLine) {
return return
} }
inc.Update(k.Low.Float64()) inc.Update(k.High.Float64())
inc.EndTime = k.EndTime.Time() inc.EndTime = k.EndTime.Time()
inc.EmitUpdate(inc.Last()) inc.EmitUpdate(inc.Last())
} }