Skip to content

Instantly share code, notes, and snippets.

@unshifty
unshifty / jurik.py
Created July 23, 2020 12:41
Pinescript jurik ma
jmapower = input(title="JMA Power", type=input.integer, defval=2)
jmaphase = input(title="Phase", type=input.integer, defval=50)
jma(src, length, phase, power) =>
phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2)
alpha = pow(beta, power)
jma = 0.0
e0 = 0.0
e0 := (1 - alpha) * src + alpha * nz(e0[1])
e1 = 0.0