afl for consolidation breakout.

1sandeepgupta

Well-Known Member
#1
Dear sir,please provide me afl explorations for consolidation breakout downside,consolidation breakout upside, consolidation over 16 weeks like provided in metastock on guppytraders.com in exploration section.Thank you.
 

1sandeepgupta

Well-Known Member
#2
Metastock code for consolidation breakout is

Congestion Index
((HHV(C,80)-LLV(C,80))/LLV(C,80))*100

Consolidation Breakout Upside
If(Ref(Fml("Congestion Index"),-5),<,10,
{and} If(Fml("Congestion Index"),>=,10,
{and} If(CLOSE,>,Ref(HHV(C,80),-5),
{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),+1,0),0),0),0)

Consolidation Breakout Downside
If(Ref(Fml("Congestion Index"),-5),<,10{%},
{and} If(Fml("Congestion Index"),>=,10{%},
{and} If(CLOSE,<,Ref(LLV(C,80),-5),
{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),+1,0),0),0),0)
 
Last edited:

1sandeepgupta

Well-Known Member
#3
hi actually I wrote two afl on the basis of the above two as fellows-

//Consolidation Breakout Upside
CongestionIndex = ((HHV(C,80)-LLV(C,80))/LLV(C,80))*100;
Filter= (Ref(CongestionIndex,-5)< 10) AND (CongestionIndex >= 10) AND (Close > Ref(HHV(C,80),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
AddColumn(C,"close",1.4);

//Consolidation Breakout Downside
CongestionIndex = ((HHV(C,40)-LLV(C,40))/LLV(C,40))*100;
Filter= (Ref(CongestionIndex,-5)< 10) AND (CongestionIndex >= 10) AND (Close < Ref(LLV(C,40),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
AddColumn(C,"close",1.4);
:)
 

1sandeepgupta

Well-Known Member
#6
plz covert this for amibroker
The new version of the above two afls in one, enjoy.
//20 is for one month consolidation,replace it for 40 for two month etc.5 is the range breadth in percentage, you can replace it for 10,if you need wider range .
CongestionIndex = ((HHV(C,20)-LLV(C,20))/LLV(C,20))*100;
//Consolidation Breakout Upside
up= (Ref(CongestionIndex,-5)< 5) AND (CongestionIndex >= 5) AND (Close > Ref(HHV(C,20),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
//Consolidation Breakout Downside
dn= (Ref(CongestionIndex,-5)< 5) AND (CongestionIndex >= 5) AND (Close < Ref(LLV(C,20),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
//Exploration for break out either upside or downside
Filter=up OR dn;
AddColumn(up,"up",1.2);
AddColumn(dn,"dn",1.2);
AddColumn(C,"close",1.4);
 

amitrandive

Well-Known Member
#10
Can anyone have plot feature shading the relevant consolidation area to see on the chart
Code:
//20 is for one month consolidation,replace it for 40 for two month etc.5 is the range breadth in percentage, you can replace it for 10,if you need wider range .
CongestionIndex = ((HHV(C,20)-LLV(C,20))/LLV(C,20))*100;
//Consolidation Breakout Upside
up= (Ref(CongestionIndex,-5)< 5) AND (CongestionIndex >= 5) AND (Close > Ref(HHV(C,20),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
//Consolidation Breakout Downside
dn= (Ref(CongestionIndex,-5)< 5) AND (CongestionIndex >= 5) AND (Close < Ref(LLV(C,20),-5)) AND (MA(V,5) >= 1.5*(Ref(MA(V,60),-5)));
//Exploration for break out either upside or downside
Filter=up OR dn;
AddColumn(up,"up",1.2);
AddColumn(dn,"dn",1.2);
AddColumn(C,"close",1.4);

_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() ); 

Plot( 1, "", IIf(up, colorPaleGreen, colorRose ),styleArea | styleOwnScale, 0, 1 );
_SECTION_END();
 

Similar threads