Valid bars count for indicator and exploration mode (with Pad&Align)

Hello to all ).

Is there a universal way in AFL to get count of valid bars for in AFL, when running in exploration mode with option "Pad&Align" to ^SPX turned on. By valid i mean real trading (days) bars count which is native to the symbol and not extended with Pad/Align option.

Right now I need to separate code for this. Say when running exploration I'm using:

barnumber = BarsSince(isEmpty(c))-1;

so every next day i'm getting correct number of the bars.

But when to apply this code as indicator - then in the chart this method does not work, because no empty bars at all, and i need to use something different, say:

barnumber = BarsSince(Status("FirstBarInRange"));

and when i'm trying to use this code in exploration with Align of data - this giving me wrong bar number because all symbols are extended with empty bars.

So I'm wondering if there is way to measure Valid Bar Number(count) in all modes?

Thanks in advance. :smile:

First of all: Pad and align is Analysis option and does NOT affect charts at all.
Secondly if you want the same in exploration, just turn OFF Pad and Align in analysis. That is simpler than turning it ON and then trying to reverse its working.

Really it helps if people actually describe the goal (what for they would like to do this or that).