Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Count Orders

  1. #1

    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,003

    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

    Default

    Quote Originally Posted by funyoo View Post
    Hi przem81621,

    Thanks for that and another

Similar Threads

  1. Count trades on a certain bar
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 15:21
  2. Count historical profit
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 15:11
  3. Count historical loss
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 15:10
  4. Count by type function
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 14:44
  5. Count all trades function
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 14:41

Posting Permissions

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