Exporting balance curves: incorrect asset name?

Posted By: boatman

Exporting balance curves: incorrect asset name? - 08/24/17 22:23

I exported a bunch of balance curves for different assets in a loop during training. When I read them back in, they don't have the correct asset identifier. Instead they all get the same asset identifier as the first asset in the loop. Here's a small script to demonstrate (uncomment the first #define statement and Train to export balance curves, then comment the first #define statement and Test to read them back in):

Code:
#define WRITECURVES
#define FILENAME "Log\TestCurves.bin"

typedef struct curve
{
	string Name;
	int Length;
	var *Values;
} curve;

curve Curve[6];


function run()
{
#ifdef WRITECURVES

	set(PARAMETERS|LOGFILE);
	StartDate = 2016;
	EndDate = 2016;
	BarPeriod = 1440;
	Curves = FILENAME;
		
	while(asset(loop("EUR/USD", "AUD/USD")))
	{
		int trades = optimize(1, 1, 3, 1);
		reverseLong(trades);
	}
	
#endif

#ifndef WRITECURVES

	byte *Content = file_content(FILENAME); // read in balance curves
	if(!Content) return; //nothing to read
	
	int i,j,N = 0;
		while(N<6 && *Content) 
	{ 
// extract next curve
		string Name = Content;
		Content += strlen(Name)+1;
		int Size = *((int*)Content);
		int Length = Size/sizeof(var); // number of values
		Content += 4;
		var *Values = Content;
		Content += Size;

// store curve and print its name and length
		Curve[N].Name = Name;
		Curve[N].Length = Length;
		Curve[N].Values = Values;
		
		printf("n%s: %d",Curve[N].Name,Length);
		N++;
	}
	quit();

#endif	
	
}



Printed to the Zorro GUI, I have the name associated with each curve. Here's the output after running this code:

Code:
TestCurves compiling...........
TestCurves_EURUSD_1_1: 180
TestCurves_EURUSD_1_2: 180
TestCurves_EURUSD_1_3: 180
TestCurves_EURUSD_1_1: 180
TestCurves_EURUSD_1_2: 180
TestCurves_EURUSD_1_3: 180
Quit



Expected:
Code:
TestCurves compiling...........
TestCurves_EURUSD_1_1: 180
TestCurves_EURUSD_1_2: 180
TestCurves_EURUSD_1_3: 180
TestCurves_AUDUSD_1_1: 180
TestCurves_AUDUSD_1_2: 180
TestCurves_AUDUSD_1_3: 180
Quit



Is there anything obvious that is incorrect in my script?

Thanks for any help.
Posted By: jcl

Re: Exporting balance curves: incorrect asset name? - 09/04/17 13:55

This looks like a wrong asset in the curve name. I'll forward this to the developers for checking.
Posted By: Dalla

Re: Exporting balance curves: incorrect asset name? - 09/22/17 11:47

Was this fixed? Ran into the same issue
Posted By: boatman

Re: Exporting balance curves: incorrect asset name? - 09/22/17 11:48

Thanks for looking into this, jcl.
Posted By: Dalla

Re: Exporting balance curves: incorrect asset name? - 09/23/17 05:11

After testing myself with the latest release (1.66) I can confirm this has been fixed
© 2024 lite-C Forums