Type : Strategy, Name : Key Reversal Pattern
Input: StopLossAmount( 250 ) ;
variable: KRPattern( false ) ;
KRPattern = Low < Low[1]
and Close > Close[1]
and Close < High ;
{ You are counting how many times the pattern recurs.
INCREMENT THE COUNT ONE BAR AFTER THE KR IS CONFIRMED. }
if KRPattern[1] then
begin
Value1 = Value1 + 1 ;
{ If there is a key reversal up pattern,
how many times is the following high greater or equal to the last high? }
if High >= High[1] then
Value2 = Value2 + 1 ;
end ;
{ Now send the results to a text file }
if LastBarOnChart then
begin
Print( File( «C:\Patt.txt» ), GetSymbolName,
» «, ELDateToString( CurrentDate), » Time: «,
CurrentTime:4:0 ) ;
Print( File( «C:\Patt.txt» ),
«Key Reversal Up Pattern» ) ;
if Value1 <> 0 then
begin
Print( File( «C:\Patt.txt» ),
«Pattern «, Value1:4:0 ) ;
Print( File( «C:\Patt.txt» ), «Total bars «,
BarNumber:4:0, » Observation on total bars «,
Value1 / BarNumber * 100, «%» ) ;
Print( File( «C:\Patt.txt» ),
«Next high is greater or equal to prev high «,
Value2:4:0, Value2 / Value1 * 100, «%» ) ;
end ;
end ;
{ If you want to see trading signals include the code below }
if KRPattern then
begin
Buy this bar on Close ;
Sell ( «Target» ) next bar at High limit ;
end ;
SetStopPosition ;
SetStopLoss( StopLossAmount ) ;
if BarsSinceEntry = 1 then
Sell ( «EOD» ) this bar on Close ;