I modified a afl got from afl library in ami site to get NR4 and NR7 days/stocks having that status on the last trading day. I wanted to get it from intraday data> hence I used timeframeset function as below.
TimeFrameSet(inDaily);
NR1_Scan = ParamToggle("Scan NR1?", "No|Yes", 1);
NR4_Scan = ParamToggle("Scan NR4?", "No|Yes", 1);
NR7_Scan = ParamToggle("Scan NR7?", "No|Yes", 1);
/*MinVR = Param("Min Volatility_Ratio", 0.5, 0.1, 1, 0.1);*/
NR1 = Inside() OR (Ref(H, -1)==H AND Ref(L, -1)<L) OR (Ref(H, -1)>H AND Ref(L, -1)==L);
NR4 = (H - L) < Ref(LLV(H-L,3),-1);
NR7 = (H - L) < Ref(LLV(H-L,6),-1);
/*Volatility_Ratio = StDev(log(C/Ref(C,-1)),5)/StDev(log(C/Ref(C,-1)),99);*/
/**********************************
The Explorer
- Run the Analysis
***********************************/
/*Filter = Volatility_Ratio>=MinVR AND (NR7 OR NR4 OR NR1);*/
Filter = (NR7 OR NR4 OR NR1);
Buy = Filter;
if (NR1_Scan) AddTextColumn(WriteIf(NR1, "Yes", "No"), "NR1", 1.0, colorDefault,colorDefault, 80);
if (NR4_Scan) AddTextColumn(WriteIf(NR4, "Yes", "No"), "NR4", 1.0, colorDefault,colorDefault, 80);
if (NR7_Scan) AddTextColumn(WriteIf(NR7, "Yes", "No"), "NR7", 1.0, colorDefault,colorDefault, 80);
/*AddColumn( Volatility_Ratio, "Vol Ratio",1.4, colorDefault,colorDefault, 80 );*/
TimeFrameRestore();
But what I get for last day trading is given in pic below. Any suggestion is welcome for this.