Moving Averages

Moving Averages

Example

using Temporal, Indicators, Plots
X = quandl("CHRIS/CME_CL1", rows=252, sort='d')
x = cl(X)
x.fields[1] = :Crude

mafuns = [sma, ema, wma, trima]
m = hcat([f(x, n=40) for f in mafuns]...)

plot(x, linewidth=3, color=:black)
plot!(m, linewidth=2)
/home/travis/.julia/packages/GR/IVBgs/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
Did you start 'gksqt'?

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

Reference

Indicators.almaMethod.
alma{Float64}(x::Array{Float64}; n::Int64=9, offset::Float64=0.85, sigma::Float64=6.0)::Array{Float64}

Arnaud-Legoux moving average (ALMA)

source
Indicators.demaMethod.
dema(x::Array{Float64}; n::Int64=10, alpha=2.0/(n+1), wilder::Bool=false)::Array{Float64}

Double exponential moving average (DEMA)

source
Indicators.emaMethod.
ema(x::Array{Float64}; n::Int64=10, alpha::Float64=2.0/(n+1.0), wilder::Bool=false)::Array{Float64}

Exponential moving average (EMA)

source
Indicators.hmaMethod.
hma(x::Array{Float64}; n::Int64=20)::Array{Float64}

Hull moving average (HMA)

source
Indicators.kamaMethod.

Kaufman adaptive moving average (KAMA)

source
Indicators.mamaMethod.
mama(x::Array{Float64}; fastlimit::Float64=0.5, slowlimit::Float64=0.05)::Matrix{Float64}

MESA adaptive moving average (MAMA)

source
Indicators.mmaMethod.
mma(x::Array{Float64}; n::Int64=10)::Array{Float64}

Modified moving average (MMA)

source
Indicators.smaMethod.
sma(x::Array{Float64}; n::Int64=10)::Array{Float64}

Simple moving average (SMA)

source
Indicators.swmaMethod.

Sine-weighted moving average

source
Indicators.temaMethod.
tema(x::Array{Float64}; n::Int64=10, alpha=2.0/(n+1), wilder::Bool=false)::Array{Float64}

Triple exponential moving average (TEMA)

source
Indicators.trimaMethod.
trima(x::Array{Float64}; n::Int64=10, ma::Function=sma, args...)::Array{Float64}

Triangular moving average (TRIMA)

source
Indicators.wmaMethod.
wma(x::Array{Float64}; n::Int64=10, wts::Array{Float64}=collect(1:n)/sum(1:n))::Array{Float64}

Weighted moving average (WMA)

source
Indicators.zlemaMethod.
zlema(x::Array{Float64}; n::Int=10, ema_args...)::Array{Float64}

Zero-lag exponential moving average (ZLEMA)

source