Hi, thanks but this doesn't give the desired effect. A toy example where I want to return a series that is the average price of EUR/USD and GBP/USD:
var ind1(var* Data) {
var temp_EURUSD;
var temp_GBPUSD;
if(Asset == "EUR/USD") {
temp_EURUSD=Data[0];
} else if(Asset == "GBP/USD") {
temp_GBPUSD=Data[0];
}
return (temp_EURUSD+temp_GBPUSD)/2; }
function run() {
set(PLOTPRICE+PLOTNOW);
PlotBars = 10000;
var* Price = series(price());
while(asset(loop("EUR/USD","GBP/USD"))) {
vars s1=series(ind1(Price));
plot("s1",s1[0],NEW,BLUE); }
}
Here I get a plot of the second currency chosen (GBP/USD) and this currency divided by 2 in the plot. So the second currency is not passed, presumably because each currency in the loop is executed individually?
How can I get this kind of indicator to work? Thanks!