52 week high and low date

#1
sir,

Kindly correct this attached afl. My requirement is show the date of highest and lowest date in entire data base and date of 52 week high and low date.



SetBarsRequired(-2,0);

allhigh = Highest(H);

allLOW = Lowest(L);

dthigh = ValueWhen(H==allhigh, DateTime(),1);
dtLOW = ValueWhen(L==allLOW, DateTime(),1);




n1 = HHV(High,260);
n2 = LLV(L,260);


dtn1 =ValueWhen(H==n1, DateTime(),1);

dtn2 =ValueWhen(L==n2, DateTime(),1);







Filter=1;
AddColumn(allhigh,"alltimehigh");
AddColumn(dthigh,"alltimehighdt",formatDateTime);

AddColumn(allLOW,"alltimeLOW");
AddColumn(dtLOW,"alltimeLOWdt",formatDateTime);
AddColumn(n1,"52wk_high");
AddColumn(dtn1,"52wk_highdt",formatDateTime);
AddColumn(n2,"52wk_Low");
AddColumn(dtn2,"52wk_Lowdt",formatDateTime);
 

Similar threads