Skip to content

Commit

Permalink
Fix building in float32 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WinPooh32 committed Feb 19, 2023
1 parent 2e81425 commit da6d60d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fta.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func PSAR(high, low, close series.Data, iaf float64, maxaf float64) (psarSeries,
psarBear := make([]DType, length)

bull := true
af := iaf
af := DType(iaf)
hp := highValues[0]
lp := lowValues[0]

Expand All @@ -385,23 +385,23 @@ func PSAR(high, low, close series.Data, iaf float64, maxaf float64) (psarSeries,
reverse = true
psar[i] = hp
lp = lowValues[i]
af = iaf
af = DType(iaf)
}
} else {
if highValues[i] > psar[i] {
bull = true
reverse = true
psar[i] = lp
hp = highValues[i]
af = iaf
af = DType(iaf)
}
}

if !reverse {
if bull {
if highValues[i] > hp {
hp = highValues[i]
af = math.Min(af+iaf, maxaf)
af = math.Min(af+DType(iaf), DType(maxaf))
}
if lowValues[i-1] < psar[i] {
psar[i] = lowValues[i-1]
Expand All @@ -412,7 +412,7 @@ func PSAR(high, low, close series.Data, iaf float64, maxaf float64) (psarSeries,
} else {
if lowValues[i] < lp {
lp = lowValues[i]
af = math.Min(af+iaf, maxaf)
af = math.Min(af+DType(iaf), DType(maxaf))
}
if highValues[i-1] > psar[i] {
psar[i] = highValues[i-1]
Expand Down

0 comments on commit da6d60d

Please sign in to comment.