Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
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
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 715 guests, and 5 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
Optimization Issues #484700
12/03/21 23:19
12/03/21 23:19
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
Okay so I am trying to optimize but keep getting same result for each parameter except the best optimal result. How can I go about it?
Check below for screenshots. Here lies the code:



function run()
{
set(LOGFILE);
StartDate = 20160101;
EndDate = 20210101;
BarPeriod = 240;
LookBack = 200;
MaxLong = 1;
MaxShort = 1;

set(PARAMETERS);
vars Close = series(priceClose());
vars Prices = series(price());
var ma_period = optimize(50,10,200,10);

BBands(Prices,50,2,2,MAType_SMA);
vars upperBand = series(rRealUpperBand);
vars lowerBand = series(rRealLowerBand);


if (crossOver(Close, upperBand)) enterLong();
else if (crossUnder(Close, lowerBand)) enterShort();


PlotWidth = 1000;
PlotHeight1 = 300;


}

Attached Files Opt01.PNGOPT02.PNG
Re: Optimization Issues [Re: Sage] #484701
12/04/21 00:22
12/04/21 00:22
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
The ma_period variable isn't used in the trade rule.

Re: Optimization Issues [Re: Grant] #484702
12/04/21 06:24
12/04/21 06:24
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
Yes that is true the ma_period variable isnt used in the trade rule, I get it now why it was not optimized.
But in reality, the ma_period affects the bands of the bollinger thereby affecting the entry and exit signals.

How can I include the ma_period variable in optimization yet excluded from the trade rules?

Re: Optimization Issues [Re: Sage] #484703
12/04/21 09:14
12/04/21 09:14
Joined: Aug 2021
Posts: 101
M
MegaTanker Offline
Member
MegaTanker  Offline
Member
M

Joined: Aug 2021
Posts: 101
I'm not sure what you are trying to do. If you pass the ma_period to the BBands function, it will be optimized. But why would you want to exclude it from the trade rules?

Re: Optimization Issues [Re: MegaTanker] #484704
12/04/21 13:32
12/04/21 13:32
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
It was excluded from the trading rules because I want a bollinger system that enters on a breakout and exit and also reverse position on the breakout to the other side

Re: Optimization Issues [Re: Sage] #484705
12/04/21 14:22
12/04/21 14:22
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Your code makes no logical sense to me. You optimize the ma_period for no reason and your rRealUpperBand & rRealLowerBand variables have default values.

Last edited by Grant; 12/04/21 14:26.
Re: Optimization Issues [Re: Sage] #484706
12/04/21 14:30
12/04/21 14:30
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
I dont want the upperband and lowerband optimized. Help or not?

Re: Optimization Issues [Re: Sage] #484707
12/04/21 16:47
12/04/21 16:47
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Fair enough, but that's the reason why you get the same results

Re: Optimization Issues [Re: Sage] #484710
12/04/21 20:13
12/04/21 20:13
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
Okay I will optimize the bands and feed you back

Re: Optimization Issues [Re: Sage] #484731
12/07/21 01:10
12/07/21 01:10
Joined: Dec 2021
Posts: 13
S
Sage Offline OP
Newbie
Sage  Offline OP
Newbie
S

Joined: Dec 2021
Posts: 13
I included the bands in the optimization and the issue was solved. Thanks


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