When using a mix of assets and algos, the manual suggests the following.
Select asset first, then algo.

Code
// initial settings
...
LookBack = max((1440 / BarPeriod) * MANUAL_LOOKBACK_DAY_SETTING, LookBackNeeded);
...

while(asset(loop(Assets))
{
    algo("trend"); trendAlgo();
    algo("reversion"); reversionAlgo();
}


However, it is often convenient to choose algo first.
For example, if you write an algo that you want to trade selectively from multiple assets.

Code
// initial settings
...
LookBack = max((1440 / BarPeriod) * MANUAL_LOOKBACK_DAY_SETTING, LookBackNeeded);
...

for(auto it : myAlgoContainerMap)
{
    algo(it.first);  // name of algo

    while(asset(loop(Assets))
    {
        it.second->run();  // process function of algo
    }
}


In this case, the number of times the asset is switched will also increase in proportion to the increase in algo.
When the asset is switched, lookback data may also need to be moved(or copied).
I'm asking you to review whether this can be a factor in performance degradation.


Last edited by 7th_zorro; 04/16/24 05:58.