Open a trade position of a symbol on a different chart

 
Can anyone please tell me how to open a EURUSD Buy/Sell position using EA on different chart for example GBPUSD.
Files:
1.mq5  1 kb
 

what will be conditions to do it

I mean your conditions will be about eurusd or gbpusd

I just wonder why you need this 

 
Ahmet Metin Yilmaz:

what will be conditions to do it

I mean your conditions will be about eurusd or gbpusd

I just wonder why you need this 

Because i want to open two order  simultaneously GBPUSD and EURUSD.
 

Hi 

Use the: SymbolInfoTick() 

// To be used for getting recent/latest price quotes of a symbol
    MqlTick latest_Price;      
    SymbolInfoTick("EURUSD" ,latest_Price);  
    
    latest_Price.ask // your EURUSD ask price
    latest_Price.bid // your EURUSD bid price

function/struct to get the latest BID/ASK price of the chosen symbol.

You can use that price in the rest of your code to send the order.

"Ahmet Metin Yilmaz " "I just wonder why you need this" 

You can use this for hedging strategies.


Greetings

 
Snelle Moda:

Hi 

Use the: SymbolInfoTick() 

function/struct to get the latest BID/ASK price of the chosen symbol.

You can use that price in the rest of your code to send the order.

"Ahmet Metin Yilmaz " "I just wonder why you need this" 

You can use this for hedging strategies.


Greetings

hi "Snelle Moda"  i used EA of this code on GBPUSD chart but instead of EURUSD it opened order of GBPUSD...

   

MqlTick latest_Price;      

    SymbolInfoTick("EURUSD" ,latest_Price);  

    trade.Sell(1.0,NULL,latest_Price.bid,0,(latest_Price.bid-100 *_Point),NULL);

 
Sumit Roy:

hi "Snelle Moda"  i used EA of this code on GBPUSD chart but instead of EURUSD it opened order of GBPUSD...

   

MqlTick latest_Price;      

    SymbolInfoTick("EURUSD" ,latest_Price);  

    trade.Sell(1.0,NULL,latest_Price.bid,0,(latest_Price.bid-100 *_Point),NULL);


Because you have not specify the correct 'symbol' when you send the order with the trade.Sell function.

trade.Sell(1.0,NULL,latest_Price.bid,0,(latest_Price.bid-100 *_Point),NULL);
Should be
trade.Sell(1.0,EURUSD,latest_Price.bid,0,(latest_Price.bid-100 *_Point),NULL);