Thanks DdlV,
I agree there should be an INITRUN in that logic, so I've added that.
I am still getting a crash when trying to read in the array (note: I'm assuming it was correctly written to the file).
I think the issue could still be the length, which I've arbitrarily set to 1000. I don't think Zorro would know the length when reading in, so I'm not sure how that would work.
plotGraph sounds neat and I might explore that (I haven't used it before) but first I need to figure out the reason for the crash.
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 if(is(INITRUN)) //read mode
{
EquityCurve=series(0);
file_read(path, EquityCurve, 1000);
}
plot("EquityCurve",EquityCurve[0],1,BLUE);
}