Type : Signal, Name : 5bv
{
Strategy:
0 require violation by close for confirmation.
1 require violation by range for confirmation.
2 require violation by close, setup day for CA
3 require violation by range, setup day for CA
etc.
Entries:
1 = A, 2 = B, 3 = CA, 4 = CB
}
Inputs: nTicks (3), Strategy (3) ;
Vars : NumPoints (MinMove * nTicks points),
Position ( 0), Confirmation(0),
NewHi (99999), NewLo ( 0),
LastHi ( 0), LastLo (99999),
BSetup (99999), SSetup ( 0),
NewLoBar( 0), NewHiBar( 0),
dummy(0), strPrice(0) ;
VALUE1=NewHi;
VALUE2=NewLo;
VALUE3=LastHi;
VALUE4=LastLo;
VALUE5=BSetup;
VALUE6=SSetup;
VALUE7=NewLoBar;
VALUE8=NewHiBar;
VALUE9=dummy;
VALUE10=strPrice;
VALUE11=Position;
VALUE12=Confirmation;
VALUE13=NumPoints;
if (CurrentBar of Data1 <= 1) then begin
NewHiBar = HighestBar (High, 10)[1] of Data1 * -1 ;
NewLoBar = LowestBar (Low, 10)[1] of Data1 * -1 ;
end ;
if (Position <> -1) then begin { ========== SELL ============ }
dummy = CurrentBar — NewHiBar ;
if (High[0] > High[dummy])
then begin
NewHiBar = CurrentBar ;
dummy = CurrentBar — NewHiBar ;
end ;
if dummy >= 1 then sell L — 3 points stop ;
Confirmation = 0 ;
if (Strategy = 3) then begin
if (Strategy = 3) then strPrice = Low ;
if (dummy = 1) then begin
NewHi = High[dummy] ;
SSetUp = Low [1] — NumPoints ;
end ;
if (dummy = 2) then begin
NewHi = High[dummy] ;
SSetUp = Lowest (Low, 2)[1] — NumPoints ;
end ;
if (dummy >= 1) and (strPrice <= SSetUp) then begin
if (Low [0] < LastLo) then
if (Low [dummy] > Low [dummy — 1])
then Confirmation = 3 { «CA.Sell » }
else Confirmation = 4 ; { «CB.Sell » }
end ;
if (Confirmation = 0) and
(dummy > 1) and (strPrice <= SSetUp) then begin
if (Low [dummy] > Low [dummy — 1])
then Confirmation = 1 { » A.Sell » }
else Confirmation = 2 ; { » B.Sell » }
end ;
end ; { Strategy #3 }
if (Confirmation > 0) then begin
dummy = CurrentBar — NewHiBar ;
{{{
if (Confirmation[0] = 1) then Plot1[Dummy] (High[Dummy], » A «) ;
if (Confirmation[0] = 2) then Plot2[Dummy] (High[Dummy], » B «) ;
if (Confirmation[0] = 3) then Plot3[Dummy] (High[Dummy], » CA «) ;
if (Confirmation[0] = 4) then Plot4[Dummy] (High[Dummy], » CB «) ;
}}}
Position = -1 ;
LastHi = NewHi ;
NewLoBar = CurrentBar — LowestBar (Low, dummy) ;
NewLo = 0 ;
SSetup = 0 ;
end;
end;
if (Position <> +1) then begin { ========== BUY =========== }
dummy = CurrentBar — NewLoBar ;
if (Low [0] < Low [dummy])
then begin
NewLoBar = CurrentBar ;
dummy = CurrentBar — NewLoBar ;
end ;
if dummy >= 1 then buy H + 3 points stop ;
Confirmation = 0 ;
if (Strategy = 3) then begin
if (Strategy = 3) then strPrice = High ;
if (dummy = 1) then begin
NewLo = Low [dummy] ;
BSetUp = High[1] + NumPoints ;
end ;
if (dummy = 2) then begin
NewLo = Low [dummy] ;
BSetUp = Highest (High, 2)[1] + NumPoints ;
end ;
if (dummy >= 1) and (strPrice >= BSetUp) then begin
if (High[0] > LastHi) then
if (High[dummy] < High[dummy — 1])
then Confirmation = 3 { «CA.Buy » }
else Confirmation = 4 ; { «CB.Buy » }
end ;
if (Confirmation = 0) and
(dummy > 1) and (strPrice >= BSetUp) then begin
if (High[dummy] < High[dummy — 1])
then Confirmation = 1 { » A.Buy » }
else Confirmation = 2 ; { » B.Buy » }
end ;
end ; { strategy #3 }
if (Confirmation > 0) then begin
dummy = CurrentBar — NewLoBar ;
{{{
if (Confirmation[0] = 1) then Plot1[Dummy] (Low[Dummy], » A «) ;
if (Confirmation[0] = 2) then Plot2[Dummy] (Low[Dummy], » B «) ;
if (Confirmation[0] = 3) then Plot3[Dummy] (Low[Dummy], » CA «) ;
if (Confirmation[0] = 4) then Plot4[Dummy] (Low[Dummy], » CB «) ;
}}}
Position = +1 ;
LastLo = NewLo ;
NewHiBar = CurrentBar — HighestBar(High, dummy) ;
NewHi = 99999 ;
BSetup = 99999 ;
end ;
end ; { currently short }