Quadruple kama

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Quadruple kama

Postby bruno2017 » Sun Feb 07, 2021 9:40 am

Hello
can you code this indicator in thank you lua.
attached the code and image

Image

CODE:
study(title="Quadruple Kaufman Adaptive Moving Average", shorttitle="QKAMA", overlay=true)

length1 = input(14, minval=1)
fastMA1 = input(2, minval=1)
slowMA1 = input(20, minval=1)
src1 = input(title="Source 1", type=source, defval=close)
tf1 = input(title="Resolution 1", type=resolution, defval = "current")
length2 = input(14, minval=1)
fastMA2 = input(3, minval=1)
slowMA2 = input(30, minval=1)
tf2 = input(title="Resolution 2", type=resolution, defval = "current")
src2 = input(title="Source 2", type=source, defval=close)
length3 = input(14, minval=1)
fastMA3 = input(4, minval=1)
slowMA3 = input(40, minval=1)
src3 = input(title="Source 3", type=source, defval=close)
tf3 = input(title="Resolution 3", type=resolution, defval = "current")
length4 = input(14, minval=1)
fastMA4 = input(5, minval=1)
slowMA4 = input(50, minval=1)
src4 = input(title="Source 4", type=source, defval=close)
tf4 = input(title="Resolution 4", type=resolution, defval = "current")

volatility1 = sum(abs(src1-src1[1]), length1)
volatility2 = sum(abs(src2-src2[1]), length2)
volatility3 = sum(abs(src3-src3[1]), length3)
volatility4 = sum(abs(src4-src4[1]), length4)

change1 = abs(src1-src1[length1-1])
change2 = abs(src2-src2[length2-1])
change3 = abs(src3-src3[length3-1])
change4 = abs(src4-src4[length4-1])

er1 = iff(volatility1 != 0, change1/volatility1, 0)
er2 = iff(volatility2 != 0, change2/volatility2, 0)
er3 = iff(volatility3 != 0, change3/volatility3, 0)
er4 = iff(volatility4 != 0, change4/volatility4, 0)

fastSC1 = 2/(fastMA1+1)
fastSC2 = 2/(fastMA2+1)
fastSC3 = 2/(fastMA3+1)
fastSC4 = 2/(fastMA4+1)

slowSC1 = 2/(slowMA1+1)
slowSC2 = 2/(slowMA2+1)
slowSC3 = 2/(slowMA3+1)
slowSC4 = 2/(slowMA4+1)

sc1 = pow((er1*(fastSC1-slowSC1))+slowSC1, 2)
sc2 = pow((er2*(fastSC2-slowSC2))+slowSC2, 2)
sc3 = pow((er3*(fastSC3-slowSC3))+slowSC3, 2)
sc4 = pow((er4*(fastSC4-slowSC4))+slowSC4, 2)

kama1 = nz(kama1[1])+(sc1*(hl2-nz(kama1[1])))
kama2 = nz(kama2[1])+(sc2*(hl2-nz(kama2[1])))
kama3 = nz(kama3[1])+(sc3*(hl2-nz(kama3[1])))
kama4 = nz(kama4[1])+(sc4*(hl2-nz(kama4[1])))

kamaR1 = security(tickerid, tf1 == "current" ? period : tf1, kama1)
kamaR2 = security(tickerid, tf2 == "current" ? period : tf2, kama2)
kamaR3 = security(tickerid, tf3 == "current" ? period : tf3, kama3)
kamaR4 = security(tickerid, tf4 == "current" ? period : tf4, kama4)

plot(kamaR1, color=yellow, title="KAMA1", trackprice=false, style=line)
plot(kamaR2, color=#2cfffe, title="KAMA2", trackprice=false, style=line)
plot(kamaR3, color=fuchsia, title="KAMA3", trackprice=false, style=line)
plot(kamaR4, color=red, title="KAMA4", trackprice=false, style=line)
bruno2017
FXCodeBase: Initiate
 
Posts: 132
Joined: Fri Mar 23, 2018 8:59 am

Re: Quadruple kama

Postby Apprentice » Sun Feb 07, 2021 6:31 pm

Your request is added to the development list.
Development reference 166.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 29696
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia



Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 3 guests