Skip to content

Commit

Permalink
fix: Reverse length, alma comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zenixls2 committed Jul 26, 2022
1 parent e097421 commit 55704fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/indicator/alma.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
type ALMA struct {
types.SeriesBase
types.IntervalWindow // required
Offset float64 // required: recommend to be 5
Sigma int // required: recommend to be 0.5
Offset float64 // required: recommend to be 0.5
Sigma int // required: recommend to be 5
weight []float64
sum float64
input []float64
Expand Down
7 changes: 2 additions & 5 deletions pkg/types/indicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,10 @@ func Array(a Series, limit ...int) (result []float64) {
//
// notice that the return type is a Float64Slice, which implements the Series interface
func Reverse(a Series, limit ...int) (result Float64Slice) {
l := -1
if len(limit) > 0 {
l := a.Length()
if len(limit) > 0 && l >= limit[0] {
l = limit[0]
}
if l > a.Length() {
l = a.Length()
}
result = make([]float64, l)
for i := 0; i < l; i++ {
result[l-i-1] = a.Index(i)
Expand Down

0 comments on commit 55704fd

Please sign in to comment.