Use MarketInfo() to get prices on "other" pairs
coz:
Hello,
I'm new to MQL and I am trying to write a program that will open an order on two different pairs at one time. For example, when GBP/USD ask hits 2.05, open a short on both GBP/USD and EUR/USD. I can only get the position to open correctly on the pair that has the EA attached to it. On the other pair I receive Error 129 (outdated prices). I have tried to use RefreshRates() and it doesn't seem to help, but I could be doing it wrong (I've read the documentation, but didn't get much from it). Can anyone point me to some information that can help me out or post some basic code to get this to work?
Thanks!
Hello,
I'm new to MQL and I am trying to write a program that will open an order on two different pairs at one time. For example, when GBP/USD ask hits 2.05, open a short on both GBP/USD and EUR/USD. I can only get the position to open correctly on the pair that has the EA attached to it. On the other pair I receive Error 129 (outdated prices). I have tried to use RefreshRates() and it doesn't seem to help, but I could be doing it wrong (I've read the documentation, but didn't get much from it). Can anyone point me to some information that can help me out or post some basic code to get this to work?
Thanks!
The backtester can only open trades on the pair selected in the tester dropdown.
If you want to open a trade on multiple pairs just pass the symbol string to the
OrderSend function like:
OrderSend("GBPUSD",OP_BUY,1,Ask,3,MarketInfo("GBPUSD",MODE_ASK)-25*MarketInfo(("GBPUSD",MODE_POINT),MarketInfo(("GBPUSD",MODE_ASK+25*MarketInfo(("GBPUSD"MODE_POINT),"Order#1",16384,0,Green); OrderSend("EURUSD",OP_BUY,1,Ask,3,MarketInfo("EURUSD",MODE_ASK)-25*MarketInfo(("EURUSD",MODE_POINT),MarketInfo(("EURUSD",MODE_ASK+25*MarketInfo(("EURUSD"MODE_POINT),"Order#1",16384,0,Green);
Excellent; thanks for the assistance phy and everlongh.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm new to MQL and I am trying to write a program that will open an order on two different pairs at one time. For example, when GBP/USD ask hits 2.05, open a short on both GBP/USD and EUR/USD. I can only get the position to open correctly on the pair that has the EA attached to it. On the other pair I receive Error 129 (outdated prices). I have tried to use RefreshRates() and it doesn't seem to help, but I could be doing it wrong (I've read the documentation, but didn't get much from it). Can anyone point me to some information that can help me out or post some basic code to get this to work?
Thanks!