# Find continous common vwap

hello everyone
i am trying to make an exploration where we can identify that there are continous common vwap within an "x" range
say for example range is defined as 1 percent than continous vwap days should be highlighed in exploration
i have made a sample excel of this idea
but i am not being able to get the necessary result in afl code
can someone here help me to improvise the code

i am attaching the excel screenshot
and also the afl result screenshot

we can try this on close too.

this is the afl -

atp=aux1;

SetOption("NoDefaultColumns", True);
AddColumn( DateTime(), "DATE", formatDatetime, colorBlack, colorwhite);

{//ROCATP COLUMNS
{for( i = 1; i < 15; i++ )
{

``````ROCATP=ROC(ATP+I,1);
COLORROCATP=IIf(Ref(ROCATP,-I)>0,colorGreen,colorRed);
VarSet("ROCATP"+I,Ref(ROCATP,-I));
}
``````

}

ROCATP=ROCATP;
ROCATP1=VARGET("ROCATP1");
ROCATP2=VARGET("ROCATP2");
ROCATP3=VARGET("ROCATP3");
ROCATP4=VARGET("ROCATP4");
ROCATP5=VARGET("ROCATP5");
ROCATP6=VARGET("ROCATP6");
ROCATP7=VARGET("ROCATP7");
ROCATP8=VARGET("ROCATP8");
ROCATP9=VARGET("ROCATP9");
ROCATP10=VARGET("ROCATP10");
ROCATP11=VARGET("ROCATP11");
ROCATP12=VARGET("ROCATP12");
ROCATP13=VARGET("ROCATP13");
ROCATP14=VARGET("ROCATP14");
ROCATP15=VARGET("ROCATP15");
}

{//atp columns

COLORATP1=IIf( ((ATP<Ref(ATP,-1)*1.01) AND (ATP>Ref(atp,-1)*0.99)),colorGreen,colorWhite);

{for( i = 1; i < 8; i++ )
{
ROCATP=ROC(ATP,1);
ROCATPP2=ROC(ATP,2);
ROCATPP3=ROC(ATP,3);

``````colorATP1=
IIf(
(Ref(ATP,-i)<(REF(ATP,-i-1)*1.005) AND Ref(ATP,-i)>(Ref(atp,-i-1)*0.995))
AND
((REF(ATP,-1-1))<(REF(ATP,-I-2)*1.005)AND (REF(ATP,-I-1))>(REF(ATP,-i-2)*0.995))
AND
((ATP<Ref(ATP,-1)*1.01) AND (ATP>Ref(ATP,-1)*0.99))
,colorGreen,colorWhite);

}
``````

}
}

{//ROCATP
ROCATP=ROC(ATP,1);
ROCATPP2=ROC(ATP,2);
ROCATPP3=ROC(ATP,3);

COLORROCATP=IIf(ROCATP>0,colorGreen,colorRed);
}
{//ROCATP COLUMNS
{for( i = 1; i < 8; i++ )
{

``````ROCATP=ROC(ATP+I,1);
COLORROCATP=IIf(Ref(ROCATP,-I)>0,colorGreen,colorRed);
``````

VarSet("ROCATP"+I,Ref(ROCATP,-I));
}
}

ROCATP=ROCATP;
ROCATP1=VARGET("ROCATP1");
ROCATP2=VARGET("ROCATP2");
ROCATP3=VARGET("ROCATP3");
ROCATP4=VARGET("ROCATP4");
ROCATP5=VARGET("ROCATP5");
ROCATP6=VARGET("ROCATP6");
ROCATP7=VARGET("ROCATP7");
ROCATP8=VARGET("ROCATP8");
ROCATP9=VARGET("ROCATP9");
ROCATP10=VARGET("ROCATP10");
ROCATP11=VARGET("ROCATP11");
ROCATP12=VARGET("ROCATP12");
ROCATP13=VARGET("ROCATP13");
ROCATP14=VARGET("ROCATP14");
ROCATP15=VARGET("ROCATP15");
}

/*
////////////////////////
i am not being able to count the common continous days
////////////////////
if i count the common continous days than i can filter by that too.and display that in a column too.
*/

filter=1;

i am trying my best, i know the code is not correct, but cam=n someone here guide me please.