Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
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
1 registered members (AndrewAMD), 177 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Cannot get negative optimize range #487469
05/05/23 04:54
05/05/23 04:54
Joined: Nov 2022
Posts: 13
Tampa Bay
B
bigsmack Offline OP
Newbie
bigsmack  Offline OP
Newbie
B

Joined: Nov 2022
Posts: 13
Tampa Bay
I am trying this conceptually - Zorro 2.5.3

Optimize for negative range with min=-135 and max=-45
so that would look like this if allowed:
var LowerThreshold = optimize(-90,-135,-45,9);

But that throws a compile error and the manual says:
For optimizing negative parameter ranges, subtract an offset or add a minus sign to the optimize call.

So I tried this with a minus sign to the optimize call and it compiles but the value set is still positive (is this the right syntax as described from the manual?):
var LowerThreshold = -optimize(90,45,135,9);

The .par file shows positive for parameter 4 in this example = 90.4 and not -90.4 as expected (Is this possibly a bug?)
USD/JPY 13.13 34.1 98.7 90.4 18.00=> 2.504

I don't know how to "subtract an offset" as the manual says - can somebody help me understand that please?

I tried some things but always get positive parameter value.

Thanks!

Re: Cannot get negative optimize range [Re: bigsmack] #487472
05/05/23 17:24
05/05/23 17:24
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
I've never tried it myself, but I guess it should be

Code
var LowerThreshold = -optimize(-90,-135,-45,9);


subtract an offset simply means something like

Code
LowerThresholdFinal = 0 - LowerThreshold;


or simply use

Code
LowerThresholdFinal = -LowerThreshold;

Last edited by Grant; 05/05/23 17:28.
Re: Cannot get negative optimize range [Re: bigsmack] #487474
05/06/23 00:44
05/06/23 00:44
Joined: Nov 2022
Posts: 13
Tampa Bay
B
bigsmack Offline OP
Newbie
bigsmack  Offline OP
Newbie
B

Joined: Nov 2022
Posts: 13
Tampa Bay
I appreciate the help Grant but your suggestions are giving the same results. No negative optimization.

Error 011: invalid optimize range -135.0--45.0

I tried all the suggestions. I multiplied by negative 1 and tried offset too.

Does anybody have this working?

Re: Cannot get negative optimize range [Re: bigsmack] #487475
05/06/23 00:52
05/06/23 00:52
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
OK, so 'var LowerThreshold = -optimize(-90,-135,-45,9);' isn't working, then why not use:

Code
var LowerThreshold = optimize(90,135,45,9);
var LowerThresholdFinal = -LowerThreshold;


So you're only using 'LowerThresholdFinal' within your trading rule(s).

This is what I meant with the 2nd & 3rd code example.



Last edited by Grant; 05/06/23 00:54.
Re: Cannot get negative optimize range [Re: bigsmack] #487476
05/06/23 01:13
05/06/23 01:13
Joined: Nov 2022
Posts: 13
Tampa Bay
B
bigsmack Offline OP
Newbie
bigsmack  Offline OP
Newbie
B

Joined: Nov 2022
Posts: 13
Tampa Bay
You, sir, are a genius!

Thank you so much!

Thanks for clarifying the obvious using the negative in the trading rule.

I was trying to force the negative to show up in the .par file but obviously that is just my brain not letting go.

Re: Cannot get negative optimize range [Re: bigsmack] #487477
05/06/23 10:46
05/06/23 10:46
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
You're welcome.

I made a small typo, I meant:

Code
var LowerThreshold = optimize(90,45,135,9);


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