-
Notifications
You must be signed in to change notification settings - Fork 30
/
kama_base.txt
23 lines (22 loc) · 970 Bytes
/
kama_base.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@version=2
//The files in this repository are created by me and provided under the MIT License
//located at https://github.com/yield65/tradingview/blob/master/LICENSE
//If you find them useful please consider making a donation, thank you.
//Bitcoin: 3F636VrPCdnbfrdP5kS4C6fHWVBffXNKCu
//Litecoin: M9MBLWAC4puDxuqs4KfgSa216q1chLuaps
//contact: [email protected]
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 )