Placing orders problem

 

 

if (Bid > 1530 && Bid < 1540 )
OrderSend(Symbol(),OP_BUYLIMIT, 1, 1530, 0 ,0 0, 0, 0, 0, Green);

 

when price is still in rang 1530 - 1540 ,program is still  sending many order.

 

How to send placing order just one order?

 

Thank you very much 

 
Vivichi:

 How to send placing order just one order?

Check if you have a BUYLIMIT at that price already . . .
 
Thank you for guidance
 

Could you please identify  the function that show the order that send at that price?

 

Thank you very much 

 
Vivichi:

Could you please identify  the function that show the order that send at that price?

 

Thank you very much 

First OrderSelect() then check OrderOpenPrice()
 
Thank you very much
 

Something like that 

bool OrdersExist(int cmd = -1)
{
   for(int k=OrdersTotal()-1;k>=0;k--)
   {
      if((OrderSelect(k,SELECT_BY_POS,MODE_TRADES))&&(OrderSymbol()==Symbol())&&(OrderMagicNumber()==MagicNumber))
      {
         if(OrderType()==cmd || cmd==-1)
            return(true);
      }
   }
   return(false);
}

 

if (Bid > 1530 && Bid < 1540 && !OrdersExist(OP_BUYLIMIT) )
OrderSend(Symbol(),OP_BUYLIMIT, 1, 1530, 0 ,0 0, 0, 0, 0, Green);
 
Thank you cyberfx
 
cyberfx.org:

Something like that 

What about checking the OrderOpenPrice() ?  there could be a OP_BUYLIMIT already at a different open price.