Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (TipmyPip, AndrewAMD, Quad, aliswee, degenerate_762), 970 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
FR: make log file name same as Script #485055
01/12/22 14:32
01/12/22 14:32
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
When training across assets from a batch file (or just using an asset box to set Asset), one can form Script string in the Init to include an asset name to ensure training writes to different .PAR files.

However, the "_train.log" still has the name of the base script, and so of course parallel processes do not write to the same file. This info gets lost.

Setting LogNumber=strxid(Asset) does not work - strxid() gives the same result for the 'first'/only asset.

Having a switch/case to set the LogNumber is possible but cumbersome. And resulting file names are not really user-friendly.

I see following possible solutions:
- make log file name be the same as Script.
- make LogNumber a string. -> It can then be set to one's desire (e.g. Algo, BarPeriod, Asset, etc)

- automatically make log file name include an asset name - like it is with Brute force optimization.


Last edited by Zheka; 01/12/22 15:18.
Re: FR: make log file name same as Script [Re: Zheka] #485056
01/12/22 15:45
01/12/22 15:45
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Related:
If there is no asset() call in the script, Zorro correctly adds asset name to the *.PAR file, *.htm and .png files. (but not to _train.log).

However, if there is:
Code
var bcy_to_usd() {	
	asset(Asset);	
	return 0.1;
}

function run() {	
	set(LOGFILE,PARAMETERS);
	NumYears=2;
		
	if(Init) {
		//sprintf(Script,"AAA%s%s",strmid(Asset,0,3), strmid(Asset,4,3));
		Script="AAA";
			
		watch("Script=",Script);
	}
	
	var Lb = optimize(10, 10, 20,10);
	
	var rate=bcy_to_usd();
	
	LifeTime=Lb;
	
	if (priceC(0)>priceC(Lb)) enterLong();	
	
}
then there is some weird behavior. See screenshot.

Attached Files Script_simple.PNG
Re: FR: make log file name same as Script [Re: Zheka] #485061
01/13/22 07:55
01/13/22 07:55
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
First select the asset, then optimize.

https://zorro-project.com/manual/en/optimize.htm

https://zorro-project.com/manual/en/errors.htm

By the way, for different logs: LogNumber = 1000*second(wdate(NOW));

Last edited by Petra; 01/13/22 08:45.
Re: FR: make log file name same as Script [Re: Zheka] #485063
01/13/22 10:52
01/13/22 10:52
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Ok, the example above is indeed faulty.

However, if you do this:
Code
var bcy_to_usd() {	
	asset("AUD/USD");	
	return 0.1;
}

function run() {
	
	set(LOGFILE,PARAMETERS);
	NumYears=2;
			
	asset(AssetBox);
	
	sprintf(Script,"AAA%s%s",strmid(Asset,0,3), strmid(Asset,4,3));
		
	var Lb = optimize(10, 10, 20,10);	
	
	var rate=bcy_to_usd();
	
	LifeTime=Lb;	
	if (priceC(0)>priceC(Lb)) enterLong();		
}
then the log file (and the .htm) get no extension.

And the original issue/ motivation for FR still hold: only the most recent optimization run gets written to the log file - which is a problem when optimizing many assets from a .BAT file.

Edit: just saw your last suggestion on LogNumber. This is workable, but user-unfriendly..go figure which file belongs to which asset... Why can't the log file name be the same as Script?

Last edited by Zheka; 01/13/22 11:02.
Re: FR: make log file name same as Script [Re: Zheka] #485070
01/14/22 11:49
01/14/22 11:49
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
https://manual.zorro-project.com/str_.htm

sprintf (string dest, string format, ...): int
Like strf, but fills a given char array with formatted data, and returns the number of characters written. The dest char array must have sufficient size. Parameters:
dest - destination string, a char array of sufficient length.
format - format string (see format codes).


static char Name[100];
sprintf(Name,.....);
Script = Name;

Re: FR: make log file name same as Script [Re: Zheka] #485072
01/14/22 13:31
01/14/22 13:31
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
You are right, sprintf() requires a char[], thank you...I usually use strf() which worked correctly.

Still, having a log file have the same name as .par file would be quite convenient. (with the LogNumber =second() with the BAT file still some files get the same name, requiring to add timeouts....so much dancing around such a trivial issue).

Re: FR: make log file name same as Script [Re: Zheka] #485073
01/14/22 13:42
01/14/22 13:42
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The log file cannot have the same name as the .par file because you normally want different scripts to share the same parameter files. Like Z1, Z2, Z12.

Besides, you can easily do that by script. Use LogNumber to store different log files, and when you want individual names, just file_copy it at the end of the session.

Re: FR: make log file name same as Script [Re: Zheka] #485075
01/14/22 18:57
01/14/22 18:57
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Different scripts sharing the same parameter files is a rare exception needed for 'publishing'/end-using Z-systems. Bulk of the work is spent in development where convenience and efficiency are key.

Besides, what's the problem with scripts 'xxxxx.c' and 'zzzzz.c' both setting Script='yyyyy' to read 'yyyyy.par' in Live/Test but writing to 'yyyyy_train.log" in Train?


Moderated by  Petra 

Gamestudio download | chip programmers | 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