indicator: rename PivotHigh value field

This commit is contained in:
c9s 2022-08-27 13:26:15 +08:00
parent 8fcc3ee368
commit 70fb6d19a9
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -13,8 +13,8 @@ type PivotHigh struct {
types.IntervalWindow types.IntervalWindow
Lows floats.Slice Highs floats.Slice
Values floats.Slice Values floats.Slice
EndTime time.Time EndTime time.Time
updateCallbacks []func(value float64) updateCallbacks []func(value float64)
@ -33,17 +33,17 @@ func (inc *PivotHigh) Last() float64 {
} }
func (inc *PivotHigh) Update(value float64) { func (inc *PivotHigh) Update(value float64) {
if len(inc.Lows) == 0 { if len(inc.Highs) == 0 {
inc.SeriesBase.Series = inc inc.SeriesBase.Series = inc
} }
inc.Lows.Push(value) inc.Highs.Push(value)
if len(inc.Lows) < inc.Window { if len(inc.Highs) < inc.Window {
return return
} }
low, ok := calculatePivotHigh(inc.Lows, inc.Window, inc.RightWindow) low, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow)
if !ok { if !ok {
return return
} }