In the manual it is written that

"User-defined bar lengths can normally be used with single-asset strategies only, as different assets would produce different bars. For a portfolio system, user-defined bars had to be simulated with the TimeFrame mechanism or with a tick function. "

Can anyone can help me about how to write correctly the following script with renko bars and multiple assets?

var BarRange = 0.0030; // 0.3 cents bar range

// Renko Bars, variant 1
int bar(vars Open,vars High,vars Low,vars Close)
{
Open[0] = round(Close[1],BarRange);
if(Close[0]-Open[0] >= BarRange) {
Close[0] = Open[0]+BarRange;
High[0] = Close[0];
Low[0] = Open[0];
return 1;
}
if(Open[0]-Close[0] >= BarRange) {
Close[0] = Open[0]-BarRange;
High[0] = Open[0];
Low[0] = Close[0];
return 1;
}
return 4;
}

function run()
{
set(PLOTNOW+TICKS+TESTNOW);
StartDate = 20050101;
BarPeriod = 60;

while(asset(loop("EUR/USD","GBP/USD","USD/JPY")))
{
if(priceClose(0) > priceClose(1)
and priceClose(1) > priceClose(2)){
reverseLong(1);
}
if(priceClose(0) < priceClose(1)
and priceClose(1) < priceClose(2)){
reverseShort(1);
}

}

}


Thanks!