I'm trying to build a proof-of-concept code that writes an array to a file, then later read it back in. I can see that it writes something to the file, but I'm not sure if I have the length code correct. Also, trying to read it back in (and verify) does not work.

Any help on this would be appreciated. Here is a sample code:
Code:
function run()
{
	StartDate = 20140101;
	EndDate = 20140212;
	BarPeriod = 15;
	int mode = 0; //1=write; 0=read
	string path = "Strategy\\dt-file-series.ini";
	vars EquityCurve;
	
	if (mode) //write mode
	{
		EquityCurve = series(EquityLong+EquityShort);
		
		if (NumOpenTotal < 5)
		{
			if(random()>0) reverseLong(1);
			else reverseShort(1);
		}
	
		if(is(EXITRUN)) file_write(path, EquityCurve, LookBack*sizeof(var));
	}
	else //read mode
	{
		file_read(path, EquityCurve, 1000);
	}
	
	plot("EquityCurve",EquityCurve[0],1,BLUE);
}


THANKS

Last edited by dusktrader; 04/28/14 10:01.