OPEN-SOURCE SCRIPT

Butterworth_2345poles - ATGS

Por kleissen86
//version=2
study("Butterworth_2345poles", overlay = true)
// © John F. Ehlers
p1 = input(defval = 7, title = "Period length", type = integer,minval=1) // Period of bars to look back on
pr=input(close,"length",source)
pi=3.14159265
DTR=pi/180 // To convert degrees to radians multiply by this DTR

// filtro de 2 polos
a21=exp(-sqrt(2)*pi/p1)
b21=2*a21*cos(DTR*(sqrt(2)*180/p1))
cf21=(1-b21+a21*a21)/4
cf22=b21
cf23=-a21*a21

but2=cf21*(pr+2*nz(pr[1])+nz(pr[2]))+cf22*nz(but2[1])+cf23*nz(but2[2])


// filtro de 3 polos
a31=exp(-pi/p1)
b31=2*a31*cos(DTR*(1.738*180/p1))
c31=a31*a31
cf31=(1-b31+c31)*(1-c31)/8
cf32=b31+c31
cf33=-(c31+b31*c31)
cf34=c31*c31

but3=cf31*(pr+3*nz(pr[1])+3*nz(pr[2])+nz(pr[3]))+cf32*nz(but3[1])+cf33*nz(but3[2])+cf34*nz(but3[3])

// filtro de 4 polos
a41=exp(-5.8/p1)
b41=2*a41*cos(DTR*(117.5/p1))
c41=exp(-2.4/p1)
d41=2*c41*cos(DTR*(332.3/p1))
cf41=(1-b41+a41*a41)*(1-d41+c41*c41)/16
cf42=b41+d41
cf43=-(a41*a41+b41*d41+c41*c41)
cf44=a41*a41*d41+b41*c41*c41
cf45=-(a41*a41*c41*c41)

but4=cf41*(pr+4*nz(pr[1])+6*nz(pr[2])+4*nz(pr[3])+nz(pr[4]))+cf42*nz(but4[1])+cf43*nz(but4[2])+cf44*nz(but4[3])+cf45*nz(but4[4])

// filtro de 5 polos
a51=exp(-5.08/p1)
b51=2*a51*cos(DTR*(211.4/p1))
c51=exp(-1.94/p1)
d51=2*c51*cos(DTR*(342.6/p1))
e51=exp(-6.28/p1)
cf51=(1-b51+a51*a51)*(1-d51+c51*c51)*(1-e51)/32
cf52=b51+d51+e51
cf53=-(a51*a51+b51*d51+c51*c51+b51*e51+d51*e51)
cf54=a51*a51*d51+b51*c51*c51+a51*a51*e51+b51*d51*e51+c51*c51*e51
cf55=-(a51*a51*c51*c51+a51*a51*d51*e51+c51*c51*b51*e51)
cf56=a51*a51*c51*c51*e51

but5=cf51*(pr+5*nz(pr[1])+10*nz(pr[2])+10*nz(pr[3])+5*nz(pr[4])+nz(pr[5]))+cf52*nz(but5[1])+cf53*nz(but5[2])+cf54*nz(but5[3])+cf55*nz(but5[4])+cf56*nz(but5[5])

plot(but2, title = "Butterworth2", style = line, color = green, transp = 0, linewidth = 2) // Plot it
plot(but3, title = "Butterworth3", style = line, color = yellow, transp = 0, linewidth = 2) // Plot it
plot(but4, title = "Butterworth4", style = line, color = orange, transp = 0, linewidth = 2) // Plot it
plot(but5, title = "Butterworth5", style = line, color = red, transp = 0, linewidth = 2) // Plot it

Oscillators

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad