Gamestudio Links
Zorro Links
Newest Posts
Indicator coding
by danatrader. 06/06/20 11:53
by Aku_Aku. 06/06/20 10:10
Reading a TXT file on server
by Truth. 06/05/20 18:22
Oanda instruments
by Morris. 06/05/20 10:24
MT4/5 - wrong M1 time
by Grat. 06/05/20 08:34
fce for close signal
by Grat. 06/05/20 06:09
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
9 registered members (danatrader, Grat, AndrewAMD, FLD, jenGs, Aku_Aku, kvm, 2 invisible), 472 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Frank_Shieh, PBSeven, Hardi01, Giuseppe, AdamWu
18461 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Optimisation results different when combining assets #477951
08/19/19 09:50
08/19/19 09:50
Joined: Feb 2019
Posts: 14
j45p41 Offline OP
j45p41  Offline OP

Joined: Feb 2019
Posts: 14

i am trying to maintain different parameter values for each asset. When I train my algo with a single asset the parameter values are different to when I run the assets as a loop combined.

When trained as a loop of assets:

COP.US/USD +1.667 10.63=> 1.118
APA.US/USD +1.667 +5=> 99.999

Trained individually:
APA.US/USD +1.667 +15=> 0.398

COP.US/USD +1.667 10.63=> 1.118

I have looked at the manual and it states that you should make your optimisation calls outside of the loop:

so my code is:

TakeProfit = optimize(0.01, 1, 5, 1, 0); //Parameter 1
Stop = optimize(0.01, 5, 15, 5, 0); //Parameter 2 - need to imcrease 15 to 30

// Testing - 1
while (stock=(loop((char*)"COP.US/USD"))){

//string algo = Algo;

algomain(stock, HLIMIT);


It looks like parameters are being shared between the loop - how do I get the same results as if ran individually pls?

i can see:

For optimizing asset- or algo-independent parameters in a portfolio system, call optimize outside the loop, but select an asset before calling optimize. The global parameters are then assigned to this asset. If individual optimization is not desired, don't use loop, but enumerate the assets in a simple for loop, f.i. for(used_assets) ..., and optimize the parameters outside the for loop. Make sure in that case to select all assets before the first optimize call; otherwise the optimizier will assume a single-asset strategy.

however the asset is only selected after the loop has started execution, so how do you select the asset outside of the loop?

Last edited by j45p41; 08/19/19 12:46.
Re: Optimisation results different when combining assets [Re: j45p41] #477966
08/20/19 08:42
08/20/19 08:42
Joined: Jul 2000
Posts: 27,225
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,225
Asset order matters - read here why and when:

You select an asset with the asset() function.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1