Results 1 to 6 of 6
 0 Attachment(s)    

Thread: Opening 2 orders at the same time

  1. #1

    Question Opening 2 orders at the same time

    Hi! Maybe it is a newbie question, but appreciate if you can let me know how I can let the EA to open 2 shorts positions at the same time in 2 different pairs. Ex.: EUR and GBPUSD. Thanks in advance for any help!

  2. #2
    Junior Member
    Join Date
    Feb 2009
    Posts
    25

    Default

    Quote Originally Posted by szmvscla View Post
    Hi! Maybe it is a newbie question, but appreciate if you can let me know how I can let the EA to open 2 shorts positions at the same time in 2 different pairs. Ex.: EUR and GBPUSD. Thanks in advance for any help!
    Try putting the EA into 2 separate charts with different magic numbers..

  3. #3

    Default

    Quote Originally Posted by andytankm View Post
    Try putting the EA into 2 separate charts with different magic numbers..
    Thanks for your reply, but I want to do it only using a chart and with the same magic number because the EA will close the orders at a SL or TP equity level.

    Ex.: The EA is running on EURUSD and after the trading signal became true it will open an EURUSD and a GBPUSD short positions at the same time, is it possible?

  4. #4
    Junior Member
    Join Date
    Feb 2009
    Posts
    25

    Default

    Quote Originally Posted by szmvscla View Post
    Thanks for your reply, but I want to do it only using a chart and with the same magic number because the EA will close the orders at a SL or TP equity level.

    Ex.: The EA is running on EURUSD and after the trading signal became true it will open an EURUSD and a GBPUSD short positions at the same time, is it possible?
    Oh.. You will need someone to rewrite the EA so that it's able to do that Yes, it's possible.

  5. #5

    Default

    Quote Originally Posted by andytankm View Post
    Oh.. You will need someone to rewrite the EA so that it's able to do that Yes, it's possible.
    I wrote the following code:

    if(SELL)
    {
    if(HideSL==false&&StopLoss>0){SL=Bid+StopLoss*poin t;}else{SL=0;}
    if(HideTP==false&&TakeProfit>0){TP=Bid-TakeProfit*point;}else{TP=0;}
    Ticket=OrderSend(symbolEU,OP_SELL,Lots,Bid,Slippag e,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    Ticket=OrderSend(symbolGU,OP_SELL,Lots,Bid,Slippag e,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    }

    But it is not working Funyoo, if possible, please help me, thanks in advance.
    Last edited by szmvscla; 11-06-2009 at 10:33.

  6. #6
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by szmvscla View Post
    I wrote the following code:

    if(SELL)
    {
    if(HideSL==false&&StopLoss>0){SL=Bid+StopLoss*poin t;}else{SL=0;}
    if(HideTP==false&&TakeProfit>0){TP=Bid-TakeProfit*point;}else{TP=0;}
    Ticket=OrderSend(symbolEU,OP_SELL,Lots,Bid,Slippag e,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    Ticket=OrderSend(symbolGU,OP_SELL,Lots,Bid,Slippag e,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    }

    But it is not working Funyoo, if possible, please help me, thanks in advance.
    Hi szmvscla,

    You have to define the bid and ask of the second pair :

    Code:
    extern string symbol2="GBPUSD";
    Code:
    ask2=MarketInfo(symbol2,MODE_ASK);
    bid2=MarketInfo(symbol2,MODE_BID);
    
    if(SELL){
       if(HideSL==false && StopLoss>0){SL=Bid+StopLoss*point;}else{SL=0;}
       if(HideTP==false && TakeProfit>0){TP=Bid-TakeProfit*point;}else{TP=0;}
       Ticket=OrderSend(NULL,OP_SELL,Lots,Bid,Slippage,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    
       if(HideSL==false && StopLoss>0){SL=bid2+StopLoss*point;}else{SL=0;}
       if(HideTP==false && TakeProfit>0){TP=bid2-TakeProfit*point;}else{TP=0;}
       Ticket=OrderSend(symbol2,OP_SELL,Lots,bid2,Slippage,SL,TP,EAName,Magic,0,Red); PlaySound("news.wav");
    }

Similar Threads

  1. EA controlling only bar opening
    By dr18 in forum Expert advisors backtesting
    Replies: 0
    Last Post: 03-12-2013, 17:07
  2. Opening at price and alternating orders
    By luisneves in forum MQL programming
    Replies: 0
    Last Post: 01-15-2013, 11:15
  3. Opening only an order per day
    By szmvscla in forum MQL programming
    Replies: 2
    Last Post: 11-06-2009, 22:56

Tags for this Thread

eur, eurusd, gbpusd, magic, magic number, news, pairs, signal, slippage, stoploss, time, trading

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •