Incorrect file name when using advise with SIGNALS

Posted By: Dalla

Incorrect file name when using advise with SIGNALS - 07/03/18 06:50

I'm using Zorro 1.84.9
Given the following asset file

Code:
Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission,Symbol,Type
ABB.ST,50,0.1,0,0,0.01,0.01,0,2,1,0.02,AV:ABB
ALFA.ST,50,0.1,0,0,0.01,0.01,0,2,1,0.02,AV:ALFA.ST
CAST.ST,50,0.1,0,0,0.01,0.01,0,2,1,0.02,AV:CAST.ST



and the following script named Debug.c
Code:
#include <r.h>

function run()
{
	assetList("AssetsLargeCap.csv");
	set(RULES);
	BarPeriod = 1440;
	LookBack = 200;
	LifeTime = 1;
	Spread = Commission = Slippage = RollLong = RollShort = 0;
	
	int period = 50; //lookback for calculating normalized/standardized values

	while(asset(loop("ABB.ST","ALFA.ST","CAST.ST"))) {
		vars price = series(price());
		vars vol = series(marketVol());
		vars pv = series(vol[0]*price[0]);
	
		//Normalized
		vars priceNorm = series(Normalize(price,period));
		vars volNorm = series(Normalize(vol,period));
		vars pvNorm = series(Normalize(pv,period));
	
		if(Train) {
			adviseLong(SIGNALS+BALANCED, 0, priceNorm[0], volNorm[0],pvNorm[0]);
			enterLong();
		}
	}
}



when training I get the following output in the message window

Code:
Debug compiling..............
Rules: Debug  2013..2018
Assets AssetsLargeCap.csv
Train ABBST_L Debug.csv.
Train ALFAST_L Debug.csv.
Train CASTST_L Debug.csv



When checking in the Data folder, I find a single file, named Debug.csv which only contains output from a single asset.

I guess there should be one file for each asset? Bug?

Also a question: Is it possible to somehow generate a single file containing signals from all specified assets. The use case would be that I ultimately don't want a separate model for each asset, but rather a general model trained on data from many assets.
Posted By: jcl

Re: Incorrect file name when using advise with SIGNALS - 07/06/18 14:15

When you use loop(), all assets are separately trained and the signals file is thus rewritten for any asset. For training them all together, don't use a loop() call, but a normal for() or while() loop.
Posted By: Dalla

Re: Incorrect file name when using advise with SIGNALS - 07/09/18 11:22

Can I somehow train one model per asset, without running separate strategies?
Posted By: jcl

Re: Incorrect file name when using advise with SIGNALS - 07/10/18 13:12

That's what your code above already does.
Posted By: Dalla

Re: Incorrect file name when using advise with SIGNALS - 07/11/18 06:06

No, that's what I'm saying.
The above script gives me a single output file, Debug.csv.

I was expecting one file per asset, named something like this
ABBST_L_Debug.csv.
ALFAST_L_Debug.csv.
CASTST_L_Debug.csv
Posted By: jcl

Re: Incorrect file name when using advise with SIGNALS - 07/13/18 09:38

Ok, the probably simplest way is file_copy() in any INITRUN to copy the Debug.csv from the previous training loop to a target file name. Or use an individual neural() function that stores the signals.
© 2024 lite-C Forums