MarketTechnicals.jl
MarketTechnicals.jl copied to clipboard
Keltnerbands
Keltner bands implementation has a minor bug. Input w is unused and the range is hardcoded as 2.
function keltnerbands(ohlc::TimeArray, n::Integer = 20, w::AbstractFloat = 2.0;
h = :High, l = :Low, c = :Close)
kma = rename(ema(typical(ohlc, h=h, l=l, c=c), n), :kma)
rng = atr(ohlc, n, h=h, l=l, c=c)
kup = rename(kma .+ (2 .* rng), :kup)
kdn = rename(kma .- (2 .* rng), :kdn)
merge(kup, merge(kma, kdn))
end