I have a chart layout that includes a 5-second chart, but it shows 1-minute data if I am using a DB with a base time interval of 1 minute. I'd like to make the chart blank instead of plotting misleading data, but Interval() only returns the user-selected interval, not the base time interval of the underlying DB.
Is there a way for AFL to get the base time interval? (If not, the workaround that I have in mind is to use a naming convention on the DB filename and check the filename for the base interval).
i know but your formula doesn't work if some bars are missing: dt_diff could be different from the database interval. Also it doesn't work when used with volumes interval, so the only workaround i found was to check all non-zero differences.
Well, not that much. You should not see difference between ValueWhen and other array functions. As to original poster question, I will simply add that to Status() function.
In next version you will simply write:
Out of curiosity after @fxshrat answer I benchmarked both formulas (repeating them 100 times in a loop) and indeed I couldn't find a significant difference, maybe a fraction of ms. @Tomasz Could you take into account/distinguish tick databases too ? Thanks a lot.
Lowest() does request all bars. So there IS a difference if there is much data (bars).
Eg. I checked on >100k bars and it is around 100 times slower then.