0 beğenilme 0 beğenilmeme
16 kez görüntülendi
pds:= Input("average trend length periods",2,252,21);
pr:=Input("Open=1 High=2 Low=3 Close=4 Vol=5 MP=6, P=7",1,7,4);
display:=Input("plot Trend line = 1, Trend points = 2",1,2,1);

{define events}
pr:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V,If(pr=6,MP(),If(pr=7,P,C))))));
price1:=7;
price2:=7;
time1:=price1>Ref(HHV(price1,pds),-1);
time2:=price2<Ref(LLV(price2,pds),-1);

{restrict to last events}
time1:=time1 AND Cum(time1)=LastValue(Cum(time1));
time2:=time2 AND Cum(time2)=LastValue(Cum(time2));

{sort events}
t1pds:=LastValue(BarsSince(time1));
t2pds:=LastValue(BarsSince(time2));
x1:=If(t1pds>=t2pds,time1,time2);
x2:=If(t1pds>=t2pds,time2,time1);
y1:=If(t1pds>=t2pds,price1,price2);
y2:=If(t1pds>=t2pds,price2,price1);

{fix coordinates}
y1:=ValueWhen(1,x1,y1);
y2:=LastValue(ValueWhen(1,x2,y2));
b1:=LastValue(BarsSince(x1));
b2:=LastValue(BarsSince(x2));
plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2);

If(display=1,plot,time1+time2)
önce Analizler kategorisinde (16 puan) tarafından | 16 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme
Merhabalar,

Aşağıdaki şekilde deneyiniz,

pds:=Input("average trend length periods",2,252,21);
pr:=Input("Open=1 High=2 Low=3 Close=4 Vol=5 MP=6, P=7",1,7,4);
display:=Input("plot Trend line = 1, Trend points = 2",1,2,1);
 
{define events}
pr1:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V,If(pr=6,MP(),If(pr=7,P,C))))));
price1:=pr1;
price2:=pr1;
time1:=price1>Ref(HHV(price1,pds),-1);
time2:=price2<Ref(LLV(price2,pds),-1);
 

time11:=time1 AND Cum(time1)=LastValue(Cum(time1));
time22:=time2 AND Cum(time2)=LastValue(Cum(time2));
 
{sort events}
t1pds:=LastValue(BarsSince(time11));
t2pds:=LastValue(BarsSince(time22));
x1:=If(t1pds>=t2pds,time11,time22);
x2:=If(t1pds>=t2pds,time22,time11);
y1:=If(t1pds>=t2pds,price1,price2);
y2:=If(t1pds>=t2pds,price2,price1);
 
{fix coordinates}
y11:=ValueWhen(1,x1,y1);
y22:=LastValue(ValueWhen(1,x2,y2));
b1:=LastValue(BarsSince(x1));
b2:=LastValue(BarsSince(x2));
plot:=y11+BarsSince(x1)*(y22-y11)/(b1-b2);
 
If(display=1,plot,time1+time2)

iyi çalışmalar
önce (34,268 puan) tarafından
9,314 soru
9,269 cevap
5,068 yorum
32,391 kullanıcı