N=1;
SH1=PivotHighVSBar(N,high,strength,strength,Length);
if SH1<>-1 then begin
N=2;
FoundHighPivot=False;
while FoundHighPivot=False and N<=MaximumPivots begin
SH2=PivotHighVSBar(N,high,strength,strength,Length);
condition1= currentbar-SH2>=starBar;
if SH2<>-1 and high[SH1]<high[SH2] and condition1 then
FoundHighPivot=true;
N=N+1;
end;
end;
N=1;
SL1=PivotLowVSBar(N,low,strength,strength,Length);
if SL1<>-1 then begin
N=2;
FoundLowPivot=False;
while FoundLowPivot=False and N<=MaximumPivots begin
SL2=PivotLowVSBar(n,LOW,strength,strength,Length);
condition2= currentbar-SL2>=starBar;
if SL2<>-1 and Low[SL1]>Low[SL2] and condition2 then
FoundLowPivot=true;
N=N+1;
end;
end;