One order in a time

 

hi everyone,

I have problem with my code,

How to make this open sell code only open one order at a time until it close by hit TP or SL then will continue to open another order.

Thanks.

 

extern   double StopLoss = 200;     // StopLoss

extern   double TakeProfit = 100;   //Takeprofit

extern   double LotSize = 0.1;        //LotSize

extern   int Slippage = 3;


int start()

{

   //Opening SELL

   double SL = Bid + (StopLoss*Point);

   double TP = Bid - (TakeProfit*Point);

   double Lot = LotSize;  

   int ticket = OrderSend (Symbol(),OP_SELL,Lot,Bid,Slippage,SL,TP,NULL,0,0);


 

Count opened orders.

if(OrdersTotal()==0)... 

 
Vasyl Nosal:

Count opened orders.

if(OrdersTotal()==0)... 

Thanks, its work. do you know where i can refer all this things with some example.
 
zaharulrizal:

hi everyone,

I have problem with my code,

How to make this open sell code only open one order at a time until it close by hit TP or SL then will continue to open another order.

Thanks.

 

extern   double StopLoss = 200;     // StopLoss

extern   double TakeProfit = 100;   //Takeprofit

extern   double LotSize = 0.1;        //LotSize

extern   int Slippage = 3;


int start()

{

   //Opening SELL

   double SL = Bid + (StopLoss*Point);

   double TP = Bid - (TakeProfit*Point);

   double Lot = LotSize;  

   int ticket = OrderSend (Symbol(),OP_SELL,Lot,Bid,Slippage,SL,TP,NULL,0,0);


int ticket;

if(OrdersTotal()==0  && ---aditional conditions if any---)

{

ticket = OrderSend (Symbol(),OP_SELL,Lot,Bid,Slippage,SL,TP,NULL,0,0);

return;

}

Even those if opening more then one trades erase return . Best of luck.  

 
zaharulrizal:
Thanks, its work. do you know where i can refer all this things with some example.
What things?