Download MetaTrader 5
To add comments, please log in or register
MQL5 Cloud Network is a distributed computing network. Just give it a try!
ayoublaser
99
ayoublaser 2015.08.02 10:58 

I build an Expert ,but it open a lot of orders at the same time. How can I make it to open just one order.

please.

    void OnTick()
      {


     int total=OrdersTotal();

      for(int pos=0;pos<total;pos++)
     
      if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
      OrderProfit();
      int ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,"op buy/1",123,0,clrBlue);
      double a=OrderProfit();
      Comment("profit order select",a);
      }




Keith Watford
Moderator
8017
Keith Watford 2015.08.02 11:11  

Haven't you posted this code already?

Write your code to check for an open order and only open a new order if there are none. 

whroeder1
13656
whroeder1 2015.08.02 13:55  
/
To add comments, please log in or register