Hi,

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"))){

asset(stock);
//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.