PureBytes Links
Trading Reference Links
|
At 09:13 PM 10/18/00 -0400, you wrote:
>Hi,
>
>Is anybody on the list aware of any ELA code exist for 3 price break methods
>(3 line break)? thanks
>
>cheers
>
>Jason
>
>
I wrote this a few months ago - it may or may not be what you are looking for.
regards,
rich
{3pb indicator - three point break.
code by Rich Estrem for TS4.
try plotting intraday bar data as dark blue on a black background, and
set plot 'cur' as point, white, and plot 'bp' as point, red}
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}
{if bc <= 3 then bp=bp[1] else bp=c[2];} 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;{c2=cur[1]};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}
{if bc <= 3 then bp=bp[1] else bp=c[2];} 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;{c2=cur[1]};c3=cur[1];
end;
end;
end;
end;
plot1(cur,"cur");
plot2(bp,"bp");
|