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/ZI5OE/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{T}(x::Array{T}; n::Int64=9, offset::T=0.85, sigma::T=6.0)::Array{T}

Arnaud-Legoux moving average (ALMA)

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

Double exponential moving average (DEMA)

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

Exponential moving average (EMA)

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

Hull moving average (HMA)

source
Indicators.kamaMethod.

Kaufman adaptive moving average (KAMA)

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

MESA adaptive moving average (MAMA)

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

Modified moving average (MMA)

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

Simple moving average (SMA)

source
Indicators.swmaMethod.

Sine-weighted moving average

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

Triple exponential moving average (TEMA)

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

Triangular moving average (TRIMA)

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

Weighted moving average (WMA)

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

Zero-lag exponential moving average (ZLEMA)

source