If you run the script on the eurusd chart, both Ask and Bid are values from that chart. In order to place a trade for other currency, replace
Bid with MarketInfo("EURJPY",MODE_BID)
Regards.

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
Can someone help me? The following code is a script that when I run, should place 2, at market price orders for 2 different currency pairs.
But... It asks me if I want to proceed, but when I click the Yes, it does nothing.
If I have the EURUSD chart open, sometimes it places that side of the trade only.
Any help would be appreciated.
Chuck
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#define MAGIC 1234
#define IDENT "Hedge by Chuck"
extern double lots = 1;
extern double stop_loss = 80; // (8 pips) optimise 50-2000
extern double take_profit = 750; // (75 pips) optimise 50-2000
int start()
{
//----
if(MessageBox("Do you really want to BUY and Sell 1.00 Lot EURUSD & EURJPY at current prices? ", //stops accidental order placement
"Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1);
{
OrderSend("EURUSD", OP_BUY, lots,Ask, 3, 0, "Hedge Order",IDENT, MAGIC, 0, Blue);
OrderSend("EURJPY", OP_SELL, lots,Bid, 3, 0, "Hedge Order",IDENT, MAGIC, 0, Red);
}
//----
return(0);
}
//+------------------------------------------------------------------+