Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Verification for OpenOrders and do .....?

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    2

    Default Verification for OpenOrders and do .....?

    Hello!
    I need just a little help..
    I have a problem in the code..
    Example:
    Check for OpenOrders and if there is 1 open order, the next open order will be 1 lot. If there is 2 Opened orders the next one will be whit 2 lots..: I have Buy signal,the expert chek for OpenOrders and found 1 Order=> the order that will be open will be whit 1lot.....
    Something like this. But becaouse I don't know the correctly code for Order counting i need help ...
    Please help..

    Good luck!

    P.S Sorry for my bad EN.

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

    Default

    Quote Originally Posted by begin_er View Post
    Hello!
    I need just a little help..
    I have a problem in the code..
    Example:
    Check for OpenOrders and if there is 1 open order, the next open order will be 1 lot. If there is 2 Opened orders the next one will be whit 2 lots..: I have Buy signal,the expert chek for OpenOrders and found 1 Order=> the order that will be open will be whit 1lot.....
    Something like this. But becaouse I don't know the correctly code for Order counting i need help ...
    Please help..

    Good luck!

    P.S Sorry for my bad EN.
    Hi begin_er and welcome,

    You have to add a count orders function :

    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);
    }
    Then in your OrderSend functions, replace Lots by :

    Code:
    NormalizeDouble(Lots*CountOrders(OP_BUY,Magic),2)
    NormalizeDouble(Lots*CountOrders(OP_SELL,Magic),2)

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    2

    Default

    Thank you, thank you verry much!! funyoo You are good man
    Verry quickly post, but now i don't have time to write the code. When I finish, i will post. THANK!!!

Tags for this Thread

expert, magic, signal, thank you, 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
  •