Skip to content

Commit

Permalink
Create kama_base.txt
Browse files Browse the repository at this point in the history
uses the original formula values from Perry Kaufman.
  • Loading branch information
yield65 authored Feb 3, 2018
1 parent 2073544 commit adc1a1d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kama_base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@version=2
study("Kaufman MA", overlay=true, precision=0)
//Default Formula values
erp = input(10, title="Efficiency Ratio Periods", step=1, minval=1)
fastMA = input(2, step=1, minval=1, title="Fast Period")
slowMA = input(30, step=1, minval=1, title="Slow Period")
//Efficiency Ratio (ER)
change = abs(close-close[erp])
volatility = sum(abs(close - close[1]), erp)
er = change/volatility
//End ER
fastAlpha = (2/(fastMA+1))
slowAlpha = (2/(slowMA+1))
sc = pow( er * (fastAlpha - slowAlpha ) + slowAlpha, 2)
kama = nz(kama[1]) + sc * (close - nz(kama[1]))
plot(kama, style=line, linewidth=2, color=green, transp=0 )

0 comments on commit adc1a1d

Please sign in to comment.