I am trying to do an exploration to exclude stocks with missing bars. I can't find any setting to do so. Therefore, I am trying to code it into the AFL using a for loop and DaysSince1900() function. This is the first time I am using a for loop so I am not able to get the hang of it. Could someone help me here complete the code.
Code:
// Find stocks with missing dates
for(i = BarCount - 1; i >= BarCount - (21*6); i--)
{
// I am not sure what statement to write here. Any suggestions?
DaysSince1900() - Ref(DaysSince1900(), -1);
Daysdiff = (Ref(DaysSince1900(), -i)) - (Ref(DaysSince1900(), -i-1));
}
filter2 = (DaysSince1900() - Ref(DaysSince1900(), -1))<5; // This only excludes the particular date. I need to exclude the stock from the exploration.
filter = Close > 0;// AND filter2;
AddColumn( DaysSince1900(), "DaysSince1900");
AddColumn(DaysSince1900() - Ref(DaysSince1900(), -1), "Diff");