How to get the historical number of trading bars?

I am looking for the formula to retrieve how long a ETF has been trading; the number of bars in it’s history.

I tried:

$TradingBars = LoopMax("Eval(Close(CTR) = NA, CTR, 0)",12,0,252)

But when I run an ETF screen with the rule

$TradingBars = 0

I get 729 ETFs. This sounds too high. Just picking the first one one the list; AAXJ, iShares MSCI All Country Asia ex Japan ETF, we can tell that this formula is incorrect because AAXJ has price data going back for years.

So, what’s going on?

Try;

$TradingBars = LoopMax("Eval(Close(CTR) != NA, CTR, 0)",12,0,252)

Then

$TradingBars = 0

Will be true for ETFs that are less than one year old.

Thanks Walter, it looks like it works now!