Possible bug with LifeTime and TradeExitTime

Posted By: Ger1

Possible bug with LifeTime and TradeExitTime - 06/27/18 09:13

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?
Posted By: Ger1

Re: Possible bug with LifeTime and TradeExitTime - 06/27/18 09:22

I also tried setting the maximum number of traded bars in a tmf, however the results did not change.

function tmf()
{
if(TradeIsOpen and TradeAlgo=="Algo1")
{
TradeExitTime=11;
}
return 8;

}

function Algo1()
{
algo("Algo1");
enterLong(tmf);
}


function Algo2()
{
algo("Algo2");
enterLong();
}
Posted By: jcl

Re: Possible bug with LifeTime and TradeExitTime - 07/02/18 09:49

LifeTime is trade specific and does not affect other trades. So the problem is somewhere else in your script - if you can't find it, and don't want to post it here, you can get help from Support.
© 2024 lite-C Forums