How opening simultaneously different pairs?

 

Hi to everybody,

I'd like my EA would open different pairs at the same time but now it opens only the first one pair not the second. Can anybody help me????

Thanks a lot in advance.

My script is something like this:

//---- input parameters

extern string sPair1 ="EURUSD";

extern string sPair2 ="USDJPY";

...

...

if (sSignalBuy==true )

{

OrderSend(sPair1,OP_BUY,dLots,Ask,iSlippage,0,0,"magic is 123",iMagic1,Blue);

OrderSend(sPair2,OP_BUY,dLots,Ask,iSlippage,0,0,"magic is 123",iMagic1,Blue);

sSignalBuy=false;

}

 

Just a few thoughts ...

I expect that the 'Ask' would be different for the 2 pairs (and would be for the 'base' pair that the EA runs under). Perhaps use MarketInfo to get Ask for the 'other' pair

I also suggest using different magicnumber (although checking pairs symbols would also differentiate)

 

Thank you brewmanz.

I need the same magicNumber for this 2 pairs because I can quickly close them at the same time (and leave open others).

Could you or anybody else add lines and correct my code?

Have a nice day ;-D

 
OrderSend(sPair1,OP_BUY,dLots,MarketInfo(sPair1,MODE_ASK),iSlippage,0,0,"magic is 123",iMagic1,Blue);
OrderSend(sPair2,OP_BUY,dLots,MarketInfo(sPair1,MODE_ASK),iSlippage,0,0,"magic is 123",iMagic1,Blue);

but you still need to add some errormanagement. what if first order gets executed..

Please consider also that simultaneosly does not exists when trading with one terminal. th

//z

 

It's not that difficult ...

if (sSignalBuy==true )
{
 double myAsk;
 myAsk = MarketInfo(sPair1,MODE_ASK);
 OrderSend(sPair1,OP_BUY,dLots,myAsk,iSlippage,0,0,"magic is 123",iMagic1,Blue);
 myAsk = MarketInfo(sPair2,MODE_ASK);
 OrderSend(sPair2,OP_BUY,dLots,myAsk,iSlippage,0,0,"magic is 123",iMagic1,Blue);
 sSignalBuy=false;
}

.. but note that the extra code was just typed, not compiled or checked, etc.

 

I appreciate your help. Thank you brewmanz and zzuegg. :-)