Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,161 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Possible bug with LifeTime and TradeExitTime #473304
06/27/18 09:13
06/27/18 09:13
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
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?

Re: Possible bug with LifeTime and TradeExitTime [Re: Ger1] #473305
06/27/18 09:22
06/27/18 09:22
Joined: Mar 2017
Posts: 65
G
Ger1 Offline OP
Junior Member
Ger1  Offline OP
Junior Member
G

Joined: Mar 2017
Posts: 65
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();
}

Last edited by Ger1; 06/27/18 09:25.
Re: Possible bug with LifeTime and TradeExitTime [Re: Ger1] #473378
07/02/18 09:49
07/02/18 09:49
Joined: Jul 2000
Posts: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
Frankfurt
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.


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1