Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keltnerbands #139

Open
banachtech opened this issue Oct 11, 2022 · 0 comments
Open

Keltnerbands #139

banachtech opened this issue Oct 11, 2022 · 0 comments

Comments

@banachtech
Copy link

banachtech commented Oct 11, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant