From f62eb301e33b77901194c6a3fdb91f49277edc9e Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 6 Sep 2022 23:39:13 +0800 Subject: [PATCH] fix: fix pivothigh indicator use high instead of low --- pkg/indicator/pivothigh.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/indicator/pivothigh.go b/pkg/indicator/pivothigh.go index 810d9742b..8414c826c 100644 --- a/pkg/indicator/pivothigh.go +++ b/pkg/indicator/pivothigh.go @@ -13,8 +13,8 @@ type PivotHigh struct { types.IntervalWindow - Highs floats.Slice - Values floats.Slice + Highs floats.Slice + Values floats.Slice EndTime time.Time updateCallbacks []func(value float64) @@ -43,13 +43,13 @@ func (inc *PivotHigh) Update(value float64) { return } - low, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow) + high, ok := calculatePivotHigh(inc.Highs, inc.Window, inc.RightWindow) if !ok { return } - if low > 0.0 { - inc.Values.Push(low) + if high > 0.0 { + inc.Values.Push(high) } } @@ -58,8 +58,7 @@ func (inc *PivotHigh) PushK(k types.KLine) { return } - inc.Update(k.Low.Float64()) + inc.Update(k.High.Float64()) inc.EndTime = k.EndTime.Time() inc.EmitUpdate(inc.Last()) } -