"Inconsistent optimize calls" if optimize before set(PARAMETERS)

Posted By: GPEngine

"Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/25/15 07:55

Train the following script with the History dir included with the 1.26 installation and the following AssetsFix.dta line.
EUR/USD 1.29401 0.00023 -0.1000 0.0400 0.0001 0.07729 5.000 1000.0

Observed:
When the it moves on to TESTNOW, the script crashes with Error 040: Inconsistent optimize calls! Bar 620: 1 - bar 621: 2
Code:
function run() {
  BarPeriod = 60;
  StartDate = 20130101;
  LookBack = 500;
  asset("EUR/USD");
  var thresh = optimize(10, 5, 10) * 0.1;
  set(PARAMETERS);
  set(TESTNOW);
  Stop = optimize(4, 2, 8) * ATR(100);
}

Posted By: jcl

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/25/15 12:13

I don't think that this works: The PARAMETERS flag must be set before you optimize a variable (not afterwards). Can you check?
Posted By: GPEngine

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/25/15 15:35

Right, thats the problem (see the topic title).
Posted By: jcl

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/25/15 18:09

Ah, I see. So the problem already bears its solution. I've also added this to the error message description as an example.
Posted By: GPEngine

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/26/15 15:36

Have you considered factoring out a setup() method which Zorro runs right before run 0 and never again? Inside that function you could, for instance, allow set but disallow optimize. That way, in cases where the order of commands matters, the order is enforced by the language's semantics. Compare this to Zorro's current design pattern, where doing things out of order generates run time errors. In this case, the run time error came very late, Train did not complain but Test did.

Perhaps you can glance at the script above know that there is something funny about it. It was not obvious to me.
Posted By: GPEngine

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/26/15 15:53

I see a pattern.

This error mode is similar to the case where I tried to have some optimize statements outside a loop(algo). Again, it's accepted by the language but the effect is undefined. It was runtime error 042 but I could not trace it to my fault and I needed to start a thread about it to figure it out. http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=53321&Number=443868#Post443868

Another example: combining Portfolio with RULES+PARAMETERS at the same time. It's accepted by the language and to my mind it is a natural outgrowth of what is taught in the workshops, basically combining all of them. The effect? Error 042.
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=52960&Number=441166#Post441166

The Remarks section of many of your manual pages are quite long. This is alot for the user to keep in his head.
Posted By: boatman

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/26/15 22:51

I agree with your comments about the manual GPEngine. It could really use an overhaul. I'm not sure what the solution is, but all those "remarks" really need to be incorporated in a better way.
Posted By: jcl

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 02/27/15 10:38

I think the problem is not the manual, but that the errors are displayed not in the first run, but somewhat later. There is no dedicated "verification run" for checking wrong order of commands - the checking is implicit in the execution.

It would be certainly more user friendly if contradicting commands or commands that violate some restrictions are found already in the first run. I'll put this on the to do list.
Posted By: boatman

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) - 03/02/15 02:19

That's great jcl, much appreciated.
© 2024 lite-C Forums