Hi is it possible to create an EA that trades multi currency in the same EA???? any body know ?? * I have the code for that and it is not working with more than a currency pair
string eurusd = "EURUSD", eurjpy = "EURJPY", usdcad = "USDCAD", gbpnzd = "GBPNZD", usdchf = "USDCHF";
int ticketeurusd = OrderSend (eurusd, OP_BUY, 0.01, Ask, 5, 0, 0, eurusd, 1, 0, clrNONE);
int ticketeurjpy = OrderSend (eurjpy, OP_BUY, 0.01, Ask, 5, 0, 0, eurjpy, 2, 0, clrNONE);
int ticketusdcad = OrderSend (usdcad, OP_BUY, 0.01, Ask, 5, 0, 0, usdcad, 3, 0, clrNONE);
int ticketgbpnzd = OrderSend (gbpnzd, OP_BUY, 0.01, Ask, 5, 0, 0, gbpnzd, 4, 0, clrNONE);
int ticketusdchf = OrderSend (usdchf, OP_BUY, 0.01, Ask, 5, 0, 0, usdchf, 5, 0, clrNONE);
I only work with multi currency ea's.
but you should use OnTimer() as the OnTick() only works for incoming ticks from the chart symbol.
And its not possible in the MT4 backtest only on live market,.
Otherwise the robot will only process on a tick coming in from the chart symbol.
Say you run on EURUSD then the code will only be executed whenever a tick comes in for EURUSD.
Not good so you run OnTimer() to keep it going over SymbolsTotal().
We do not have a clear description of what it is you want to do.
If you want to diversify risk by automatically opening up a hedged counter position, which can be a good thing,
You let the EA listen for orders and upon sensing a new order, have it open up the additional position.