indicator: fix slice

This commit is contained in:
c9s 2022-07-27 01:43:36 +08:00
parent 0e18aa68f7
commit 4fd318701d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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
}