-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Indicators.hma(Float64.(.1:.1:10.0))
works, but Indicators.hma(Float32.(.1:.1:10.0))
throws a dispatch error when it calls wma
.
I think this is because the wma
is defined, both the input and weight array are of type T<:Real
. By default wma's weight array will be a Float64
array, forcing the input array to also be Float64
. With financial data we might sometimes want to work with Float32
or other real number types.
I think it is as simple as changing this:
function wma(x::AbstractArray{T}; n::Int64=10, wts::AbstractArray{T}=collect(1:n)/sum(1:n)) where {T<:Real}
to this:
function wma(x::AbstractArray{T}; n::Int64=10, wts::AbstractArray{W}=collect(1:n)/sum(1:n)) where {T<:Real, W<:Real}
which would allow x
to be a type different from wts
.
Metadata
Metadata
Assignees
Labels
No labels