MarketTechnicals.jl icon indicating copy to clipboard operation
MarketTechnicals.jl copied to clipboard

Percentage Price Oscillator - PPO

Open iblislin opened this issue 6 years ago • 4 comments

https://www.investopedia.com/terms/p/ppo.asp

iblislin avatar Apr 17 '18 10:04 iblislin

I would like to tackle this. Would something like below suffice?

Largely inspired by macd.

function ppo(ta::TimeArray{T,N}, fast::Int=12, slow::Int=26, signal::Int=9; wilder::Bool=false) where {T,N})
    x = ema(ta, fast, wilder=wilder)
    y = ema(ta, slow, wilder=wilder)
    
    dif = x .- y
    sig = ema(ta, signal, wilder=wilder)
    osc =  dif ./ y .* 100

    cols = ["ppo", "dif", "signal"]
    new_cols = (N > 1) ? gen_colnames(ta.colnames, cols) : cols
    
    merge(merge(osc, dif), sig, colnames=new_cols)
end

alexandrebrilhante avatar Jun 12 '18 11:06 alexandrebrilhante

Just saw #114.

alexandrebrilhante avatar Jun 12 '18 11:06 alexandrebrilhante

I guess we can revive #114, add some tests, and merge.

Arkoniak avatar Apr 04 '21 17:04 Arkoniak

yeah, that's a good starting point.

iblislin avatar Apr 06 '21 06:04 iblislin