Just copy and paste the code into a new EasyLanguage Indicator.
inputs: LeftStrength( 3 ) , RightStrength( 3 ), LookBackLength( 100 ) ;
variable: ID(-1), Offset( 0 ) , HighValue1(0), HighValue2(0), LowValue1(0), LowValue2(0), myValue1(0); Offset = .25 * Average( Range, 5 ) ;
if PivotHighVSBar( 1, High, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then begin HighValue1 = PivotHighVS(1, High, Leftstrength, RightStrength, LookBackLength );
HighValue2 = PivotHighVS(2, High, Leftstrength, RightStrength, LookBackLength );
if HighValue2 <> -1 and ( ( HighValue1 >= HighValue2 - Offset ) and ( HighValue1 <= HighValue2 + Offset ) ) then begin ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "DT");
Text_SetStyle(ID, 2, 0) ;
Text_SetColor(ID, black);
myValue1 = 1; end ;
if HighValue2 <> -1 and HighValue1 > HighValue2 and myvalue1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], High[RightStrength] + Offset, "HH"); Text_SetStyle(ID, 2, 0 ) ;
Text_SetColor(ID, Green); end else if HighValue2 <> -1 and HighValue1 < HighValue2 and myvalue1 = 0 then begin ID = Text_New(Date[RightStrength], Time[Rightstrength], High[RightStrength] + Offset, "LH"); Text_SetStyle(ID, 2, 0) ;
Text_SetColor(ID, Red); end ; myValue1 = 0; end ;
if PivotLowVSBar( 1, Low, LeftStrength, RightStrength, RightStrength + 1 ) <> -1 then begin LowValue1 = PivotLowVS(1, Low, Leftstrength, RightStrength, LookBackLength );
LowValue2 = PivotLowVS(2, Low, Leftstrength, RightStrength, LookBackLength );
if LowValue2 <> -1 and ( ( LowValue1 >= LowValue2 - Offset ) and ( LowValue1 <= LowValue2 + Offset ) ) then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "DB"); Text_SetStyle(ID, 2, 0) ;
Text_SetColor(ID, black);
myValue1 = 1;
end;
if LowValue2 <> -1 and LowValue1 < LowValue2 and myValue1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "LL"); Text_SetStyle(ID, 2, 0 ) ;
Text_SetColor(ID, Red);
end else if LowValue2 <> -1 and LowValue1 > LowValue2 and myValue1 = 0 then begin ID = Text_New(Date[RightStrength], Time[RightStrength], Low[RightStrength] - Offset, "HL"); Text_SetStyle(ID, 2, 0 ) ;
Text_SetColor(ID, Green);
end;
myValue1 = 0;
end ;
plot1(high,"highlow",white);
#function PivotHighVSBar
inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ;
variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, 1, var0, var1 ) ;
PivotHighVSBar = var1 ;
#function PivotHighVS
inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ;
variables: var0( 0 ), var1( 0 ) ;
Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, 1, var0, var1 ) ;
PivotHighVS = var0 ;
#function PivotLowVSBar
inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ;
variables: var0( 0 ), var1( 0 ) ;
Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, -1, var0, var1 ) ;
PivotLowVSBar = var1 ;
#function PivotLowVS
inputs: Instance( numericsimple ), PriceValue( numericseries ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Len( numericsimple ) ;
variables: var0( 0 ), var1( 0 ) ; Value1 = Pivot( PriceValue, Len, LeftStrength, RightStrength, Instance, -1, var0, var1 ) ;
PivotLowVS = var0 ;
#function Pivot
inputs: PriceValue( numericseries ), Len( numericsimple ), LeftStrength( numericsimple ), RightStrength( numericsimple ), Instance( numericsimple ), HiLo( numericsimple ), oPivotPriceValue( numericref ), oPivotBar( numericref ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ), var4( false ), var5( false ) ;
var3 = 0 ;
var5 = false ;
var1 = RightStrength ;
while var1 < Len and var5 = false begin var0 = PriceValue[var1] ;
var4 = true ;
var2 = var1 + 1 ;
while var4 = true and var2 - var1 <= LeftStrength begin condition1 = ( HiLo = 1 and var0 < PriceValue[var2] ) or ( HiLo = -1 and var0 > PriceValue[var2] ) ;
if condition1 then var4 = false else var2 = var2 + 1 ;
end ;
var2 = var1 - 1 ;
while var4 = true and var1 - var2 <= RightStrength begin condition1 = ( HiLo = 1 and var0 <= PriceValue[var2] ) or ( HiLo = -1 and var0 >= PriceValue[var2] ) ;
if condition1 then var4 = false else var2 = var2 - 1 ; end ;
if var4 = true then var3 = var3 + 1 ;
if var3 = Instance then var5 = true else var1 = var1 + 1 ;
end ;
if var5 = true then begin oPivotPriceValue = var0 ;
oPivotBar = var1 + ExecOffset ; Pivot = 1 ; end else begin oPivotPriceValue = -1 ; oPivotBar = -1 ; Pivot = -1 ;
end;