Foreign() exploration if current symbol has not enough data

Hello guys,

Any idea how to do an exploration for foreign() if there is not enough rows for the current symbol?

Index = Foreign("BTCUSDT", "C", True);
IndexMA = MA(Index, 200);

Filter = 1;

AddColumn(Index, "Close_index");
AddColumn(MA(Index, 200), "MA200");
AddColumn(Close, "Close");

Using analysis set symbol as BTCUSDT, compute MA and store to Static Variable.

Then for other symbols that have lesser bars, just retrieve the static variable and use it.

Make sure to use the same periodicity/interval etc to avoid unexpected results. For real time scan, you would need to run an additional analysis to update Static variables continuously.

You can also use Pad & Align using a well-behaved symbol with an appropriate history.