Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
optimize() limitations? #425524
07/07/13 16:26
07/07/13 16:26
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
It appears optimize() can't be used with BarPeriod? (& other System Variables?) Is this correct? Are there any other optimize() limitations?

Re: optimize() limitations? [Re: DdlV] #425535
07/08/13 06:55
07/08/13 06:55
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
AFAIK there are no optimize limitations. Maybe you've changed BarPeriod at the wrong moment, such as after loading the asset?

Re: optimize() limitations? [Re: jcl] #425558
07/08/13 13:22
07/08/13 13:22
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
I've tried with exactly one BarPeriod = optimize(...).

With no if(is(INITRUN)), Train works but the parameter graph is identical for all values, no matter what optimize settings I've tried (so far).

With the BarPeriod = optimize(...) inside an if(is(INITRUN)), Train gives an error 040, Bar 1:2 - Bar 2:0.

Zorro 1.12.

Re: optimize() limitations? [Re: DdlV] #425562
07/08/13 13:55
07/08/13 13:55
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You can find the meaning of all error numbers in the manual under "Error messages". Error 040 just means a wrong number of optimize calls. You can not sometimes optimize and sometimes not - either you call optimize in every run, or not at all.

http://manual.zorro-trader.com/optimize.htm

If you can't find the problem, please post your script here and I'll look over it.

Re: optimize() limitations? [Re: jcl] #425567
07/08/13 14:26
07/08/13 14:26
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks jcl. I've been to the manual many times. But that doesn't mean I understand it all! laugh

First, shouldn't the error/result be the same no matter where BarPeriod is set?

As for the example code, this:
Code:
function run()
{
	set(PARAMETERS);
	BarPeriod = optimize(240,60,1440,60);
	Stop =	10 * PIP;
	Trail =	10 * PIP;
	enterLong();
}



gives identical results for all optimize parameters I've tried so far.

This:

Code:
function run()
{
	set(PARAMETERS);
	if(is(INITRUN)) BarPeriod = optimize(240,60,1440,60);
	Stop =	10 * PIP;
	Trail =	10 * PIP;
	enterLong();
}



gives the Error 040.

Re: optimize() limitations? [Re: DdlV] #425569
07/08/13 14:48
07/08/13 14:48
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The Error 040 is because you called optimize() only in the first run. It is not allowed to have a different number of optimize calls in different runs.

As to why you got identical results, I'll have to ask. Maybe once the bars are built, subsequent changes to BarPeriod have no effect. If so, then you have to use TimeFrame instead of BarPeriod for optimizing the bar period:

Code:
function run()
{
	BarPeriod = 60;
	set(PARAMETERS);
	TimeFrame = optimize(4,1,24,1);
	Stop =	10 * PIP;
	Trail =	10 * PIP;
	enterLong();
}


Re: optimize() limitations? [Re: jcl] #425571
07/08/13 15:01
07/08/13 15:01
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks jcl. It's so much fun being a junior programmer again & making such idiotic mistakes... frown

At least now it's maybe sunk in that optimize() is not a "meta" process set up once at the beginning of strategy execution, but rather implemented as a regular function call...

But BarPeriod may be... Thanks for the TimeFrame code.

Re: optimize() limitations? [Re: DdlV] #425662
07/09/13 20:51
07/09/13 20:51
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
jcl, I tried your TimeFrame optimization above but am suspicious of the results. Every odd parameter value (e.g., 1, 3, 5, ... 23) has exactly the same result. Some of the other results are duplicated too, but not that often. This has happened with every asset I've tried so far. Do these results really make sense?

Re: optimize() limitations? [Re: DdlV] #425688
07/10/13 08:50
07/10/13 08:50
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I also had to ask and learned that they are correct, but do in fact not make much sense. Reason is that for TimeFrame only the time frames on the Period slider are supported. Inbetween time frames are ignored, so as if you had not set time frame at all.

This was not documented and is in fact an unnecessary limitation in my opinion, so in the next Zorro version all time frames will be supported, even odd values.

Re: optimize() limitations? [Re: jcl] #425730
07/10/13 11:54
07/10/13 11:54
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks jcl. Please clarify what the "time frames on the Period slider" are. I though the Period slider set BarPeriod, not TimeFrame. For a given BarPeriod, what TimeFrames are currently supported in 1.12?

Page 1 of 2 1 2

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