can i code the EA that attach in EURUSD chart to open or do something with GBPUSD ?

 
can i code the EA that attach in EURUSD chart to open or do something with GBPUSD ?

or i have to manage only the currency pair the EA attached on?
 
Yes, You can
 
thnx but how? pls guide me
 
All you have to remember is that Symbol() function and price functions (Ask, Bid) are reading data from this window where your EA is attached to. so you have to change it and show what you want. For price information there is a MarketInfo() function which gives you all dataset what you could need to open, close and modify a order.

So the code [to open a buy] could look something like this:
string Sym = "GBPUSD";
double ask   =MarketInfo(Sym,MODE_ASK);
 
OrderSend(Sym, OP_BUY, 1.0, ask, 5, 0, 0, "BUY", magic, 0, Gold);
 
thank you ... i got it ^_^
 
Yes! But don't forget RefreshRates() function to be sure that you've got the up-to-date price data.

So, the code have to be like that:

string Sym = "GBPUSD";

RefreshRates();

double ask   =MarketInfo(Sym,MODE_ASK);
 
OrderSend(Sym, OP_BUY, 1.0, ask, 5, 0, 0, "BUY", magic, 0, Gold);
 
zolero wrote:
All you have to remember is that Symbol() function and price functions (Ask, Bid) are reading data from this window where your EA is attached to. so you have to change it and show what you want. For price information there is a MarketInfo() function which gives you all dataset what you could need to open, close and modify a order.

So the code [to open a buy] could look something like this:
string Sym = "GBPUSD";
double ask   =MarketInfo(Sym,MODE_ASK);
 
OrderSend(Sym, OP_BUY, 1.0, ask, 5, 0, 0, "BUY", magic, 0, Gold);



Does it mean it's open trade to buy GBPUSD? Then if we want to buy/sell a few specific pairs of currency, how would the EA  be?
 
this EA can open GBPUSD even attached on EURUSD chart
 
codersguru:
Yes! But don't forget RefreshRates() function to be sure that you've got the up-to-date price data.

So, the code have to be like that:

string Sym = "GBPUSD";

RefreshRates();

double ask   =MarketInfo(Sym,MODE_ASK);
 
OrderSend(Sym, OP_BUY, 1.0, ask, 5, 0, 0, "BUY", magic, 0, Gold);

somehow I have the feeling that refreshrates() doesn't help you. I don't think that it refreshes all data in your program but rather active pair or what function Symbol() is giving you. Maybe I'm totally wrong but it makes sense for a matter of speed. so if this is the case you can drop this function because it doesn't help you.. .
 
I am trying to open a trade on a different pair than the chart i am on, and using this:
string Sym = "EURUSD";
double ask =MarketInfo(Sym,MODE_ASK);
Print("eurusd=",ask);
I get "eurusd=0"
whatup?
(this is in the strategy tester journal., not live trading)
aha.. it works in real time.. not strategy tester...
 
this strategy can not be tested by backtest ,
 it will only open trade with the symbol you chosed
Reason: