I've encountered the issue that the first symbol in the back test dictates what the data range will be for the StaticVarGenerateRanks loop.
According to multiple threads on this forum the way to solve it is to use pad and align and select a symbol whose data has the date range of the analysis. However, it didn't do anything. Trying the other way; selecting a symbol with a shorter data period then the first symbol does shorten the range of the data as expected, so it's not like pad and align doesn't work.
This code is just to test the problem, so I tried to make it as simple as possible. The issue happens regardless of what ranking method I use.
When I turn on pad and align I get correct results from Explorer for the cut dates (when it's off I don't get any results), but the backtest results are still the same (only data range of the first symbol).
You were right, trying to simplify the code only caused other issues. The problem is my original code was using TimeFrameSet(inWeekly) inside the symbols loop, dropping it fixed the problem. I'll leave it out for now.
TimeFrameSet() just changes the built-in variables. Any variables that you assigned inside the TimeFrameSet() / TimeFrameRestore() block (like your ranking values) would typically be expanded individually with TimeFrameExpand().