From 4fd318701d0dd8080d12212c319c6469d7e34fe0 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 27 Jul 2022 01:43:36 +0800 Subject: [PATCH] indicator: fix slice --- pkg/indicator/pivot_low.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/indicator/pivot_low.go b/pkg/indicator/pivot_low.go index af27e2f44..b3bbeee3f 100644 --- a/pkg/indicator/pivot_low.go +++ b/pkg/indicator/pivot_low.go @@ -72,7 +72,8 @@ func calculatePivotLow(lows types.Float64Slice, window int) (float64, error) { return 0., fmt.Errorf("insufficient elements for calculating with window = %d", window) } - min := lows[length-1-(window-1):].Min() + end := length-1 + min := lows[end-(window-1):].Min() if min == lows.Index(int(window/2.)-1) { return min, nil }