Help on Higher Low and Lower High Amibroker Code

amitrandive

Well-Known Member
#2
Hi All,

I am new to Amibroker coding and need some help.

Can anyone help me with the code for finding the higher low and lower high in a chart?
Code:
 _SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

Q=Param("% Change",2.1,1,10,1);
Z= Ref(Zig(C ,q ),-1) ;
HH=Ref(((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(z,q,1 ) >Peak(Z,q,2))),-1);
LH=Ref(((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(Z,q,1 ) <Peak(Z,q,2))),-1);
HL=Ref(((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) >Trough(Z,q,2))),-1);
LL=Ref(((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) <Trough(Z,q,2))),-1);
GraphXSpace = 5;
dist = 0.5*ATR(20);
 
for( i = 0; i < BarCount; i++ )
{
if( HH[i] ) PlotText( "HH", i, H[ i ]+dist[i], colorBlue,stylethick);
if( LH[i] ) PlotText( "LH", i, H[ i ]+dist[i], colorBlue,stylethick);
if( HL[i] ) PlotText( "HL", i, L[ i ]-dist[i], colorYellow,stylethick );
if( LL[i] ) PlotText( "LL", i, L[ i ]-dist[i], colorYellow,stylethick );
 
}
 

Similar threads