Sunday, 13 October 2019

Narrow Range Explorer for Amibroker (AFL)


Narrow Range Explorer for Amibroker (AFL)

For identifying Narrow ranges of Prices.
Identifies following with explorer:
1. NR 4
2. NR 7
3. NR 14
4. NR 21
5. Tweezer Top
6. Tweezer Bottom
More the price is Narrower, the more the possibility of Price range expanding in the subsequent sessions.
Use the AFL in Day Time Frame


_SECTION_BEGIN("NARROW RANGES");

TimeFrameMode(0);

TimeFrameSet( inDaily );



range = H-L;
Condition = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3);
NR4 = IIf(Condition,True, False);




range = H-L;
Condition0 = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3)AND range<Ref(range,-4)AND range<Ref(range,-5)AND range<Ref(range,-6);
NR7 = IIf(Condition0,True, False);


range = H-L;
Condition1 = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3)AND range<Ref(range,-4)AND range<Ref(range,-5)AND range<Ref(range,-6)AND range<Ref(range,-7)AND range<Ref(range,-8)AND range<Ref(range,-9)AND range<Ref(range,-10);
Condition2 = range<Ref(range,-11) AND range<Ref(range,-12) AND range<Ref(range,-13);

NR14 = IIf(Condition1 AND Condition2,True, False);


range = H-L;
Condition3 = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3)AND range<Ref(range,-4)AND range<Ref(range,-5)AND range<Ref(range,-6)AND range<Ref(range,-7)AND range<Ref(range,-8)AND range<Ref(range,-9)AND range<Ref(range,-10);
Condition4 = range<Ref(range,-11) AND range<Ref(range,-12) AND range<Ref(range,-13)AND range<Ref(range,-14)AND range<Ref(range,-15)AND range<Ref(range,-16)AND range<Ref(range,-17)AND range<Ref(range,-18)AND range<Ref(range,-19)AND range<Ref(range,-20);

NR21 = IIf(Condition3 AND Condition4,True, False);



TT = (H == Ref(H,-1)) OR (H == Ref(H,-2) AND H > Ref(H,-1)) OR (H == Ref(H,-3) AND H >= HHV(H,-2)) OR (H == Ref(H,-4) AND H >= HHV(H,-3));
TB = (L == Ref(L,-1)) OR (L == Ref(L,-2) AND L < Ref(L,-1)) OR (L == Ref(L,-3) AND L <= LLV(L,-2)) OR (L == Ref(L,-4) AND L <= LLV(L,-3));

NRSTATUS =
WriteIf(TT,"TWEEZER TOP",
WriteIf(TB,"TWEEZER BOTTOM",
WriteIf(NR21,"NR21",
WriteIf(NR14,"NR21",
WriteIf(NR7,"NR7",
WriteIf(NR4,"NR4"," "))))));
NRCOLOR = IIf( TT, colorOrange,
IIf( TB , colorBrightGreen,
IIf( NR4 OR NR7 OR NR21 OR NR14, colorLime, colorGold)));

Filter = NR4 OR NR7 OR NR21 OR NR14 OR TT OR TB ;

AddTextColumn(NRstatus, "DLY NR/TWEEZER", 1,colorDarkRed, NRcolor,120);

TimeFrameRestore();

_SECTION_END();

No comments:

Post a Comment

Thanks