[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

System works on TS 4.0 bus not on TS2000i?



PureBytes Links

Trading Reference Links

Any idea, why the following system works on TS 4.0 bus not on TS2000i?

Thanks in advance.

{----START CODE---}
{ 
B  Buy at Close
H  Buy at High Stop

S  Sell at Close
L  Sell at Low Stop

X  Exit OpenPosition (Long/Short)

XH  Exit Short at High
XL  Exit Long at Low
}

var: handl(0), lab(""), gotLab(false);

gotLab = false;
begin { examine all the text strings }
handl = text_getfirst(2);

while handl > 0 begin
lab = text_getstring(handl);

if lab = "H" { for Buy at High Stop }
or lab = "B" { for Buy at Close }

or lab = "L" { for Sell at Low Stop }
or lab = "S" { for Sell at Close }

or lab = "X" { for Exit Long/Short at Close }
or lab = "XH" {for ExitShort at High }
or lab = "XL" {for ExitLong at Low }

   then   

if text_gettime(handl) = time then
if text_getdate(handl) = date then begin
gotLab = true;
end;

if gotLab then
handl = 0 { exit the loop }
 else 
handl = text_getnext(handl,2); { IMPORTANT -- infinite loop if this is missing! }
end;
end;

if gotLab then BEGIN

{ Entries - Long }
 if lab = "H" then buy at High + 200 points Stop
 else if lab = "B" then buy at Close

{ Entries - Short }
 else if lab = "L" then sell at Low  - 200 points Stop
 else if lab = "S" then sell at Close

{ Exit } 
 else if lab = "X" then begin
  exitlong at Close;
  exitshort at Close;
 end

 else if lab = "XH" then begin
  exitshort at High + 200 points stop;
 end

 else if lab = "XL" then begin
  exitlong at Low - 200 points stop;
 end;

END;