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

Re: need TS4 swing high



PureBytes Links

Trading Reference Links

Chris,

Here are the texts for functions: SwingHighBar and SwingLowBar and the indicator SwingHighLow from my TS8. They might work in TS4. The functions have been written to correct the original TS versions which were wrong.

Jan Philipp

Inputs: Occur(Numeric), Price(NumericSeries), LStren(NumericSimple), RStren(NumericSimple), Length(Numeric);
Variables: SHBar(0), MainLoop(0), count(0), Found(false),LeftCount(0);

SO_SwingHighBar = -1;
Count = 0;

Found = false;
MainLoop = RStren;
While Found = false and MainLoop <= Length
Begin
Condition1 = True;
Condition2 = True;
SHBar = Price[MainLoop];

For value1 = MainLoop -1 DownTo MainLoop - RStren
Begin
IF SHBar <= Price[value1] Then Condition1 = False;
End;

IF Condition1 Then
Begin
value1 = MainLoop + 1;
LeftCount = 0;
while value1 <= Length and Condition2 = true and LeftCount < LStren
begin
IF SHBar < Price[value1] Then Condition2 = False;
if SHBar > Price[value1] Then LeftCount = LeftCount + 1;
value1 = value1 + 1;
End;
end;


IF Condition1 AND Condition2 and LeftCount = LStren Then
Begin {Found a match}
Count = Count + 1;
if Count = Occur then
begin
Found = true;
SO_SwingHighBar = MainLoop;
end;
End;
MainLoop = MainLoop + 1;
End;


Inputs: Occur(Numeric), Price(NumericSeries), LStren(NumericSimple), RStren(NumericSimple), Length(Numeric);
Variables: SLBar(0), MainLoop(0), count(0), Found(false),LeftCount(0);

SO_SwingLowBar = -1;
Count = 0;

Found = false;
MainLoop = RStren;
While Found = false and MainLoop <= Length
Begin
Condition1 = True;
Condition2 = True;
SLBar = Price[MainLoop];

For value1 = MainLoop -1 DownTo MainLoop - RStren
Begin
IF SLBar >= Price[value1] Then Condition1 = False;
End;
IF Condition1 Then
Begin
value1 = MainLoop + 1;
LeftCount = 0;
while value1 <= Length and Condition2 = true and LeftCount < LStren
begin
IF SLBar > Price[value1] Then Condition2 = False;
if SLBar < Price[value1] Then LeftCount = LeftCount + 1;
value1 = value1 + 1;
End;
end;

IF Condition1 AND Condition2 and LeftCount = LStren Then
Begin {Found a match}
Count = Count + 1;
if Count = Occur then
begin
Found = true;
SO_SwingLowBar = MainLoop;
end;
End;
MainLoop = MainLoop + 1;
End;


Input: RightStrength(3), LeftStrength(1),SHRange(50),SLRange(50);
Vars:SHB1(0),SLB1(0);

SHB1=SO_swinghighbar(1, H, LeftStrength,RightStrength, SHRange);
SLB1=SO_swinglowbar(1, L, LeftStrength,RightStrength, SLRange);

If SHB1 <> -1 and SLB1 <> -1 then
begin
If SHB1 < SLB1
then begin
Plot1[SHB1](High[SHB1],"swngHL");
Plot1(High,"swngHL");
end
else begin
Plot1[SLB1](Low[SLB1],"swngHL");
Plot1(Low,"swngHL");
end;

end;







----- Original Message ----- From: "Chris Cheatham" <chris.cheatham@xxxxxxxxxx>
To: "Omega List" <omega-list@xxxxxxxxxx>
Sent: Thursday, September 28, 2006 9:31 AM
Subject: need TS4 swing high


Hi,

I wonder if someone could send me the text of the old ts4 (or 2000i) swing
high or swing low function. I would like to make a streamlined one to used
instead of the function-within-function-within-function version that they
use now, and I no longer have old TS installed anyplace. Would save a bunch
of time to simply copy instead of having to undo all the layers of TS8
wrapper silliness or create it from scratch.

Thanks,
Chris