How can I test opening positions on symbols that are currently not selected?

I apologize if this has been answered before.

I am trying to test a simple mean reversion strategy by going long one and short another currency. Very simple I know. I know going long on symbol that is selected now is as simple as doing a buy = ... but how can I do this simultaneously on another currency?

Thanks!

I suppose that you have defined a watchlist with the two currency symbols. So, what you need is to adapt your AFL code to generate a long signal or a short signal depending of what symbol is Amibroker processing in this moment. You can get his name using the function "Name()".
For example, if your symbols are "ABC" (for long positions) and "XYZ" (for short positions) I'll use the following code:

switch(Name()) {
	case "ABC":
		Buy = ...;
		Sell = ...;
		Short = 0;
		Cover = 0;
		break;

	case "XYZ":
		Buy = 0;
		Sell = 0;
		Short = ...;
		Cover = ...;
		break;

	default:
		// Nothing to do?
		Buy = 0;
		Sell = 0;
		Short = 0;
		Cover = 0;
		break;
}

Thank you so much! this is brilliant and I am so much closer.

I made these changes. I currently have the AUD_JPY window open and when there is a simple crossover I want the EURJPY and EURAUD to go long at the same time while this goes short. But when I study the trades I mostly see AUDJPY trades opening and occasional two other symbols.

I must be doing it wrong. Please advise.

Thanks!

switch(Name()) {
	case "EUR_JPY":
		Buy = Cross(MA(Foreign("AUD_JPY","C"), 10),MA(Foreign("AUD_JPY","C"), 20));
		Sell = Cross(MA(Foreign("AUD_JPY","C"), 20),MA(Foreign("AUD_JPY","C"), 10));
		Short = 0;
		Cover = 0;
		break;

	case "EUR_AUD":
		Buy = Cross(MA(Foreign("AUD_JPY","C"), 10),MA(Foreign("AUD_JPY","C"), 20));
		Sell = Cross(MA(Foreign("AUD_JPY","C"), 20),MA(Foreign("AUD_JPY","C"), 10));
		Short = 0;
		Cover = 0;
		break;
		
	case "AUD_JPY":
		Buy = 0;
		Sell = 0;
		Short = Cross(MA(C, 10),MA(C, 20));
		Cover = Cross(MA(C, 20),MA(C, 10));
		break;

	default:
		// Nothing to do?
		Buy = 0;
		Sell = 0;
		Short = 0;
		Cover = 0;
		break;
}

Can you explain what do you mean with this paragraph?
With your code I think that the backtest results should show three operations at a time, one for each symbol. And there should not appear "other two symbols"...
I suppose the problem can be in the rest of the AFL code...

TIP: When possible I like to simplify my code. For example:

switch(Name()) {
	case "EUR_JPY":
	case "EUR_AUD":
		AUD_JPY = Foreign("AUD_JPY","C");
		Buy = Cross(MA(AUD_JPY,10), MA(AUD_JPY,20));
		Sell = Cross(MA(AUD_JPY,20), MA(AUD_JPY,10));
		Short = 0;
		Cover = 0;
		break;
		
	case "AUD_JPY":
		Buy = 0;
		Sell = 0;
		Short = Cross(MA(C,10), MA(C,20));
		Cover = Cross(MA(C,20), MA(C,10));
		break;

	default:
		// Nothing to do?
		Buy = 0;
		Sell = 0;
		Short = 0;
		Cover = 0;
		break;
}

With less code it's easier to find "typos"...

All trades I see are just AUD_JPYs and occasional EUR_AUD and EUR_JPYs when my expectation is 3 trade simultaneously opening.

Knowledge Base has relevant article:
http://www.amibroker.com/kb/2014/09/20/broad-market-timing-in-system-formulas/