Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Running 2 EA's in 1 metatrader

  1. #1

    Question Running 2 EA's in 1 metatrader

    Hello,

    I'm trying to run 2 similar EA's in 2 separate EURUSD 1M charts, but they only pass 1 order at a time. I realized that to do this, I need to use the magic number.

    But now I have another problem. I have code similar to this:

    if OrdersTotal() > 0 //i am in a trade
    {
    do my calculation and OrderClose
    }

    if OrdersTotal() == 0 //i am out of a trade
    {
    then open a new trade OrderSend
    }

    My problem is that the OrdersTotal function, returns all open orders...therefore both charts. I need to know if an order is open only in the current chart.

    Is there any way on doing this?
    Thanks

  2. #2
    Member
    Join Date
    Jan 2009
    Location
    Austria
    Posts
    325

    Default

    Quote Originally Posted by italiangoose View Post
    Hello,

    I'm trying to run 2 similar EA's in 2 separate EURUSD 1M charts, but they only pass 1 order at a time. I realized that to do this, I need to use the magic number.

    But now I have another problem. I have code similar to this:

    if OrdersTotal() > 0 //i am in a trade
    {
    do my calculation and OrderClose
    }

    if OrdersTotal() == 0 //i am out of a trade
    {
    then open a new trade OrderSend
    }

    My problem is that the OrdersTotal function, returns all open orders...therefore both charts. I need to know if an order is open only in the current chart.

    Is there any way on doing this?
    Thanks
    You have to combine the OrderTotal function with the Magic number, like

    for(int i=0;i<CountOrders(Magic);i++)

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    1

    Default

    You need code like this:


    //+------------------------------------------------------------------+
    //| (C) mizaindo |
    //+------------------------------------------------------------------+
    int myOrdersTotal() {
    int i;
    int count=0;

    for(i=0; i<OrdersTotal(); i++)
    {
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
    if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=myMagicNo) continue;
    count++;
    }

    return (count);
    }

Similar Threads

  1. Can Anyone Help for Running the EA
    By mrdotcom in forum Ideas for expert advisors
    Replies: 2
    Last Post: 07-15-2013, 13:51
  2. Is Funyoo still running this forum
    By tkaboris in forum General discussion
    Replies: 3
    Last Post: 03-20-2011, 06:34
  3. EA Stops Running
    By abundance in forum MQL programming
    Replies: 1
    Last Post: 09-24-2009, 10:16
  4. Issues when running several EAs on a same platform
    By billsechen in forum Trading discussion
    Replies: 5
    Last Post: 05-28-2009, 18:04
  5. Running MT4 in Linux
    By mel8331 in forum Trading discussion
    Replies: 0
    Last Post: 01-12-2009, 23:31

Tags for this Thread

eurusd, magic, magic number, metatrader, time

Posting Permissions

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