Skip to content

Commit

Permalink
Cast values.
Browse files Browse the repository at this point in the history
  • Loading branch information
cinar committed Oct 15, 2024
1 parent 9a79f90 commit 1ecce16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions trend/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ func NewEnvelope[T helper.Number](ma Ma[T], percentage T) *Envelope[T] {
func NewEnvelopeWithSma[T helper.Number]() *Envelope[T] {
return NewEnvelope(
NewSmaWithPeriod[T](DefaultEnvelopePeriod),
DefaultEnvelopePercentage,
T(DefaultEnvelopePercentage),
)
}

// NewEnvelopeWithEma function initializes a new Envelope instance using EMA.
func NewEnvelopeWithEma[T helper.Number]() *Envelope[T] {
return NewEnvelope(
NewEmaWithPeriod[T](DefaultEnvelopePeriod),
DefaultEnvelopePercentage,
T(DefaultEnvelopePercentage),
)
}

Expand All @@ -60,12 +60,12 @@ func (e *Envelope[T]) Compute(closings <-chan T) (<-chan T, <-chan T, <-chan T)

upper := helper.MultiplyBy(
middleSplice[0],
1+(e.Percentage/100),
1+(e.Percentage/100.0),
)

lower := helper.MultiplyBy(
middleSplice[2],
1-(e.Percentage/100),
1-(e.Percentage/100.0),
)

return upper, middleSplice[1], lower
Expand Down

0 comments on commit 1ecce16

Please sign in to comment.