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

Thread: Count Orders

  1. #1
    Member
    Join Date
    Nov 2008
    Posts
    257

    Default Count Orders

    I,m suppose that is simply problem.
    i want to know what is number of each trade, but no ticket.
    it should be counter of trades.
    ex.
    turn on ea - countersell,counterbuy=0
    first sell trade was open - countersell=1
    second sell trade countersell=2
    first buy counterbuy=1

    ........

    turn of ea
    how to code this?

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

    Default

    Quote Originally Posted by przem81621 View Post
    I,m suppose that is simply problem.
    i want to know what is number of each trade, but no ticket.
    it should be counter of trades.
    ex.
    turn on ea - countersell,counterbuy=0
    first sell trade was open - countersell=1
    second sell trade countersell=2
    first buy counterbuy=1

    ........

    turn of ea
    how to code this?
    Hi przem81621,

    Here is a count orders function :

    Code:
    int CountOrders(int Type)
    {
       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);
    }
    Then in the code :

    Code:
    CountOrders(OP_BUY);
    CountOrders(OP_SELL);

  3. #3
    Member
    Join Date
    Nov 2008
    Posts
    257

    Default

    Quote Originally Posted by funyoo View Post
    Hi przem81621,

    Thanks for that and another

+ Reply to Thread

Similar Threads

  1. Limit Orders Manager
    By madscalp in forum Scripts and other tools
    Replies: 7
    Last Post: 02-08-2011, 12:58
  2. Maximum Orders
    By j_l in forum MQL programming
    Replies: 6
    Last Post: 04-16-2009, 11:13
  3. Pipstep change as more orders are placed
    By BillR in forum MQL programming
    Replies: 9
    Last Post: 04-14-2009, 05:43
  4. Duplicate Orders
    By BillR in forum MQL programming
    Replies: 1
    Last Post: 04-09-2009, 12:58
  5. Replies: 12
    Last Post: 03-19-2009, 18:28

Posting Permissions

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