indicator: fix length slice calculation

This commit is contained in:
c9s 2022-07-27 01:32:37 +08:00
parent 5dd14feb42
commit 0e18aa68f7
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -72,7 +72,7 @@ func calculatePivotLow(lows types.Float64Slice, window int) (float64, error) {
return 0., fmt.Errorf("insufficient elements for calculating with window = %d", window)
}
min := lows[length-(window-1):].Min()
min := lows[length-1-(window-1):].Min()
if min == lows.Index(int(window/2.)-1) {
return min, nil
}