how to save AlgoVars in Dummy Asset

Posted By: gamadeus

how to save AlgoVars in Dummy Asset - 05/30/19 15:00

I would like to save and load the some AlgoVars for a DUMMY asset, however I find that Zorro is not able to do that (or I made an error somewhere). Take this example script below:

function run()
{
if(is(INITRUN)) assetAdd("DUMMY");
if(Bar >= 1) {
algo("TEST");
asset("#DUMMY");

AlgoVar[0] = 123;
SaveMode = SV_ALGOVARS;
saveStatus("DataTest.trd");
quit();

AlgoVar[0] = 456;
printf("n %.0f",AlgoVar[0]);
loadStatus("DataTest.trd");
printf("n %.0f",AlgoVar[0]);
quit();
}
}


I noticed that this has to do with the `#` for the DUMMY Asset, which I need because I do not want to load any data, not even 1s for it.
But apparently, since the script prints 456 twice, the hash prevents not just loading of price data but loading of any Algovars into that Asset from the trd file.

And is there any way to circumvent this with a blank asset?
Posted By: jcl

Re: how to save AlgoVars in Dummy Asset - 05/31/19 12:12

The algovars are specific to existing assets or algos. So it makes no sense to use a dummy asset here. If you only want to save some variables, use putvar and getvar. They are asset independent.
Posted By: gamadeus

Re: how to save AlgoVars in Dummy Asset - 05/31/19 17:07

you are right, jcl. I realized that myself when thinking more on the problem. thanks for your advice!
© 2024 lite-C Forums