For instance, the algorithm below optimizes a couple of parameters (TimeFactor and Coef) in the EUR/USD, GBP/USD and AUD/USD symbols. As a result, the best couple of parameters is 3.45 and 2.90 in EUR/USD, 3.64 and 8.01 in GBP/USD, and 3.59 and 8.10 in AUD/USD.
However, if my code would run as I want, we would obtain the same parameters for the 3 symbols (for example, 3.5 and 5 for EUR/USD, GBP/USD and AUD/USD markets). This is an example of multi-symbol algorithm. In this way the optimization look for the same set of parameter for different markets in order to get the best trading results combining the same algorithm with the same parameters in different markets.


function run()
{
set(LOGFILE);
set(PARAMETERS);

StartDate=2018;
NumYears=1;

BarPeriod = 60;
LookBack = 100*5;

while( asset( loop("EUR/USD","GBP/USD","AUD/USD") ) )
{
var TimeFactor = optimize(3,1,5,1);
var Coef = optimize(3,1,10,1);

vars Price = series(price(0));
vars MA1 = series(SMA(Price,30));
vars MA2 = series(SMA(Price,30*TimeFactor));

Stop = Coef*ATR(10);

if(crossOver(MA1,MA2))
enterLong();
else if(crossUnder(MA1,MA2))
enterShort();
}
}

What would be the correct way?

If they could also correct me, I would finally end this problem