Handling of NAs

is there way to create a buy rule where a stock that has more than X number of NAs, is excluded as a buy?

There's no built-in function today that exposes the number of NAs a stock encounters in a ranking system for use in buy/sell rules.

The closest workaround is to manually check each factor with IsNA() and sum them up:

eval(IsNA(PEExclXorTTM), 1, 0) + eval(IsNA(ROE%Q), 1, 0) + eval(IsNA(AvgRec), 1, 0) < 3

This is obviously tedious if your ranking system has many factors, and it won't stay in sync automatically if you change the ranking system later.

A native function along the lines of RankNaCount("MyRankingSystem") that returns the per-stock NA count for use in buy/sell rules would be a natural extension. Might be worth a Feature Request post if there's interest.

1 Like

@falnu some time ago I did the request :grin:

You could vote for it :smiley:

@ScifoSpace How do I vote for it? Claude can’t understand why its not yet a buy rule since P123 calculates it for rank performance testing.

Click in the link in the previous mail and in the upper part you can vote

Anyway in the thread of the votation there are a few interesting ideas

1 Like

Curious how others handle NAs. If a stock ranks high, but has alot of NAs do you exclude it? What’s your threshold?

A version of an NA counter is quite easy to do: one that returns the % of NA's in the line-items that we pull, all the line items. It will not look at your rules ,or the factors that you use in ranking/AI factor. That is much harder. This easy version is already a task in our to-do list. I suspect it will be enough to flag stocks with too many NAs

3 Likes

I think this would be quite useful. I have spent the last week building models to test rank vs the number of NAs in stocks recommended in my system. I have now reached the point where the models are showing once you reach a certain threshold of NAs, the data is no longer as clean and the model is showing lower ranked stocks with fewer NAs are outperforming higher ranked stocks. Unfortunately I am having to run a few different models to get all the results.

2 Likes

It would be great @marco Thanks for the consideration in this item

It's already in QA :slight_smile:

1 Like

PerNAPct() and related factors is now available . I'll make a formal announcement

2 Likes

Great @marco . I truly appreciate that. For micro small cap strategies could be very useful. Thanks so much

deleted / moved