Originally Posted by 7th_zorro
So, my question is how to handle assets with sub-groups if I have 1,000 assets?
Need to calculate every assets at every bar even though some of them only used?
Depends on your strategy. At 1,000 assets, I'd start to become more concerned about scalability problems, especially while running a 32-bit Zorro instance.

That aside, create every possible needed series needed for every asset in every run call. You can make an array of series, like this (pseudocode):

vars Prices[NUMBER_OF_ASSETS];
vars EMAs[NUMBER_OF_ASSETS];

for every asset{
Prices[ASSET_NUMBER] = series(price());
EMAs[ASSET_NUMBER] = series(EMA(Prices[ASSET_NUMBER],14));
}

Then your trading logic comes after this loop. You can retrieve the series by an assigned asset number, from 0 through (NUMBER_OF_ASSETS - 1).

Like this:

vars aPrice = Prices[ASSET_NUMBER];
vars aEMA = EMAs[ASSET_NUMBER];