Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, howardR), 472 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
"Inconsistent optimize calls" if optimize before set(PARAMETERS) #448888
02/25/15 07:55
02/25/15 07:55
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
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);
}


Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: GPEngine] #448915
02/25/15 12:13
02/25/15 12:13
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
I don't think that this works: The PARAMETERS flag must be set before you optimize a variable (not afterwards). Can you check?

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: jcl] #448926
02/25/15 15:35
02/25/15 15:35
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Right, thats the problem (see the topic title).

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: GPEngine] #448928
02/25/15 18:09
02/25/15 18:09
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Ah, I see. So the problem already bears its solution. I've also added this to the error message description as an example.

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: jcl] #448963
02/26/15 15:36
02/26/15 15:36
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
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.

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: GPEngine] #448964
02/26/15 15:53
02/26/15 15:53
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
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.

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: GPEngine] #448982
02/26/15 22:51
02/26/15 22:51
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
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.

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: boatman] #448985
02/27/15 10:38
02/27/15 10:38
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
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.

Re: "Inconsistent optimize calls" if optimize before set(PARAMETERS) [Re: jcl] #449042
03/02/15 02:19
03/02/15 02:19
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
That's great jcl, much appreciated.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1