I got an issue executing LifeTime and TradeExitTime properly.

Various algos/asset combinations are coded in a loop. I want one of those strategies("Algo1") to exit after 10 bars, which I first tried using LifeTime=10.
The issue is that not only "Algo1" is exited after 10 bars but other strategies as well.
Be aware that I already reset LifeTime=0 when executing the other algos.

I used following type of code:

function algo1()
{
algo("Algo1");
LifeTime=10;
enterLong();
}

function algo2()
{
algo("Algo2");
LifeTime=0;
enterLong();
}

...

while(algo(loop("Algo1","Algo2","Algo3")))
while(asset(loop("Asset1","Asset2")))
{
if(Algo=="Algo1") algo1();
if(Algo=="Algo2") algo2();
...
}




Can anyone advise what's going wrong here?