+ Reply to Thread
Results 1 to 7 of 7
 0 Attachment(s)    

Thread: Maximum Orders

  1. #1
    j_l
    j_l is offline
    Member
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    184

    Default Maximum Orders

    Hi funyoo,

    do you have a module to add "maxOrder"?
    So that I can determine, how much trade concurrently per pair are allowed.
    Best regards and thanks for your efforts!!!!!

    j_l
    Last edited by j_l; 03-27-2009 at 12:56.

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,178

    Default

    Quote Originally Posted by j_l View Post
    Hi funyoo,

    do you have a module to add "maxOrder"?
    So that I can determine, how much trade concurrently per pair are allowed.
    Best regards and thanks for your efforts!!!!!

    j_l
    Hi j_l,

    Add :

    After the other functions :

    Code:
    //|---------count orders
    
    int CountOrders(int Type,int Magic)
    {
       int _CountOrd;
       _CountOrd=0;
       for(int i=0;i<OrdersTotal();i++)
       {
          OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
          if(OrderSymbol()==Symbol())
          {
             if((OrderType()==Type&&(OrderMagicNumber()==Magic)||Magic==0))_CountOrd++;
          }
       }
       return(_CountOrd);
    }
    Before the ordersend functions :

    Code:
    if((CountOrders(OP_BUY,Magic)+CountOrders(OP_SELL,Magic))<MaxOrders)
       {
    After the ordersend functions :

    Code:
    }
    In the extern parameters :

    Code:
    extern int MaxOrders=100;//|---------------------maximum orders allowed

  3. #3
    j_l
    j_l is offline
    Member
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    184

    Default

    Thank You So Much

  4. #4
    Junior Member
    Join Date
    Mar 2009
    Posts
    15

    Default Multiple orders at a time

    So is this the code I would use to have more than one order opened by a single ea? If not, can you point me to the right spot on the forum or explain to me here how I can get my ea to open up to 5 orders at a time. Not at the same time, but to continue looking for trading opportunities when a trade is already opened.

    Thanks

    Shawn

  5. #5
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,178

    Default

    Quote Originally Posted by snkpool View Post
    So is this the code I would use to have more than one order opened by a single ea?
    Hi snkpool,

    That's correct.

  6. #6
    Junior Member
    Join Date
    Mar 2009
    Posts
    15

    Default

    I am getting several variable undefined errors with type, magic, count_ord, and total.

    I copied and pasted as is. Am I doing something wrong?

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

    Default

    Quote Originally Posted by snkpool View Post
    I am getting several variable undefined errors with type, magic, count_ord, and total.

    I copied and pasted as is. Am I doing something wrong?
    Hi snkpool,

    Without the entire code, it's hard to know.

+ Reply to Thread

Similar Threads

  1. RSI Power Maximum
    By funyoo in forum Expert advisors backtesting
    Replies: 103
    Last Post: 01-30-2012, 19:16
  2. Limit Orders Manager
    By madscalp in forum Scripts and other tools
    Replies: 7
    Last Post: 02-08-2011, 13:58
  3. Duplicate Orders
    By BillR in forum MQL programming
    Replies: 1
    Last Post: 04-09-2009, 13:58
  4. RSI Power Maximum
    By funyoo in forum Expert advisors demo statements
    Replies: 3
    Last Post: 03-03-2009, 22:25
  5. Count Orders
    By przem81621 in forum MQL programming
    Replies: 2
    Last Post: 02-18-2009, 21:05

Posting Permissions

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