BenR schreef op 23 juni 2012 20:08:
@ johannes51: Het bepalen van entry en exit punten in de trends:
per = 34 //Donchian Periods
periods=50 //Hurst CMA Periods
//////////////////////////////////////////////////////////
//Hurst CMA
n=(periods*2)-4
p=(n/2)-1
de48=DPO[periods*2](close)
if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then
flag=1
endif
d100=DPO[n](close)
moy100=close-d100
co=(moy100-moy100[1]+(close[p])/n)*n
if flag[1]=1 and flag[2]=0 then
hh=co[1]
endif
if flag[1]=1 then
co=hh
endif
n=periods mod 2
p=(periods-n)/2
periods=(2*p)+1
once x=0
w=abs((p-x)/p)
w=w*w*w
w=(1-w)
w=w*w*w
x=x+1
if barindex=periods then
a=0
b=0
e=0
for i=1 to periods
z=barindex-i+1
a=a+w[z]
b=b+w[z]*(i)
e=e+(i)*(i)*w[z]
next
endif
if barindex>periods then
c=0
d=0
for i=1 to periods
z=barindex-i+1
c=c+co[periods+p-i]*w[z]
d=d+co[periods+p-i]*w[z]*(i)
next
endif
alpha=(a*d-b*c)/(a*e-b*b)
beta=(c*e-b*d)/(a*e-b*b)
lowess=alpha*(p+1)+beta
if barindex<periods*2 then
lowess=undefined
endif
xx=1.8*AverageTrueRange[10](close)
lowess1=lowess+xx
lowess2=lowess-xx
////////////////////////////////////////////////
// Donchian Channels
FU= highest[per](high)
FL=lowest[per](low)
DL = FL+((FU-FL)*0.236)
DH = FL+((FU-FL)*0.786)
////////////////////////////////////////////
return lowess1 AS "TCT Trend High",DH AS "TCT High Trigger",DL AS "TCT Low Trigger",lowess2 AS "TCT Trend Low",FU AS "TCT Donchian High",FL AS "TCT Donchian Low"