AFL for Triangle breakout
To detect stocks which finishing consolidation by dimming swings off.
Script:
Max60 = HHV(Ref(C,-1),60);
Min60 = LLV(Ref(C,-1),60);
DK0 = Max60<1.15*Min60;
Max40 = HHV(Ref(C,-1),40);
Min40 = LLV(Ref(C,-1),40);
DK1 = Max40<1.1*Min40;
Max20 = HHV(Ref(C,-1),20);
Min20 = LLV(Ref(C,-1),20);
DK2 = Max20<1.07*Min20;
Max5 = HHV(Ref(C,-1),5);
Min5 = LLV(Ref(C,-1),5);
DK3 = Max5<1.03*Min5;
Tyletang = (C-Ref(C,-1))/Ref(C,-1);
DK4 = Tyletang >=0.02;
Gianhonhat = (C+Ref(C,-1)+Ref(C,-2)+Ref(C,-3)+Ref(C,-4)+Ref(C,-5))/6;
DK5 = Gianhonhat >=3;
Buy = DK1 AND DK2 AND DK3 AND DK4;