Avoiding stale data

How would I write a buy rule to avoid stale data, e.g., a rule that the quarterly data is <= 90 days old.

stalestmt = 0 is key. Then you can also use latestactualdays. When latestactualdays is NA, I use this formula: isna(latestactualdays,isna(dayssince(max(latestfilingdate-1,latestnewsdate)),7*weeksintoq)).

I don’t know if this is the best way, but in my universes I add this constraint to weed out companies that should have reported but haven’t.

DaysLate <=5 //filings not more than 5 days late based on estimate

https://www.portfolio123.com/doc/doc_detail.jsp?factor=DaysLate&popUpFullDesc=1

Ok great, thx guys.

I wrote about 2 dozen custom variables for detecting stale and recent data. Looking back on them now, I notice a few significant shortcomings.

If I were to redo these functions, I would like to remind myself that dates regardings actuals/estimates, any fundamentals, Compustat fundamentals, data sourcing, last update, and reporting periods all mean different things in context.