door Paul M » za 03 dec 2005, 21:58
Hoi Kane,
Deze werkt alleen in TS.
var:v1(0),v2(0),h1(0),h2(0),bp(0),cur(0),dir(0),bc(0),d1(0),t1(0),c1(0),c2(0),c3(0);
if t[1] = Sess1FirstBarTime and bc=0 then begin {initialize var's}
if c > c[1] then dir=1 else dir=-1;
v1=TL_New(D[1],T[1],c[1],D[1],t[1],c);
v2=TL_New(D,T,c[1],D,t,c);
h1=TL_New(D[1],T[1],c[1],D,t,c[1]);
h2=TL_New(D[1],T[1],c,D,t,c);
bp=c[1]; {breakpoint/price}
cur=c; {current max price}
bc=1;
d1=d;
t1=t;
c1=c[1];
c2=c[1];
c3=c[1];
end else begin
if dir=1 then begin
if c > cur then begin {plot a new up box}
v1=TL_New(D1,T1,c1,D1,t1,c);
v2=TL_New(D,T,c1,D,t,c);
h1=TL_New(D1,T1,c1,D,t,c1);
h2=TL_New(D1,T1,c,D,t,c);
TL_SetColor(h1,7);
TL_SetColor(h2,7);
TL_SetColor(v1,7);
TL_SetColor(v2,7);
cur=c; {new current max price}
bc=bc+1; {inc barcounter}
bp=c3;
d1=d;
t1=t;
c3=c2;
c2=c1;
c1=c;
end else begin
if c < bp then begin {then change direction to dn}
v1=TL_New(D1,T1,c2,D1,t1,c);
v2=TL_New(D,T,c2,D,t,c);
h1=TL_New(D1,T1,c2,D,t,c2);
h2=TL_New(D1,T1,c,D,t,c);
TL_SetColor(h1,6);
TL_SetColor(h2,6);
TL_SetColor(v1,6);
TL_SetColor(v2,6);
cur=c; {new current max price}
dir=-1; {change direction}
bp=c1;
d1=d;
t1=t;
c1=c;
c3=cur[1];
end;
end;
end;
if dir=-1 then begin
if c < cur then begin {plot a new up box}
v1=TL_New(D1,T1,c1,D1,t1,c);
v2=TL_New(D,T,c1,D,t,c);
h1=TL_New(D1,T1,c1,D,t,c1);
h2=TL_New(D1,T1,c,D,t,c);
TL_SetColor(h1,6);
TL_SetColor(h2,6);
TL_SetColor(v1,6);
TL_SetColor(v2,6);
cur=c; {new current max price}
bp=c3;
d1=d;
t1=t;
c3=c2;
c2=c1;
c1=c;
end else begin
if c > bp then begin {then change direction to up}
v1=TL_New(D1,T1,c2,D1,t1,c);
v2=TL_New(D,T,c2,D,t,c);
h1=TL_New(D1,T1,c2,D,t,c2);
h2=TL_New(D1,T1,c,D,t,c);
TL_SetColor(h1,7);
TL_SetColor(h2,7);
TL_SetColor(v1,7);
TL_SetColor(v2,7);
cur=c; {new current max price}
dir=1; {change direction}
bp=c1;
d1=d;
t1=t;
c1=c;
c3=cur[1];
end;
end;
end;
end;
Paul