Count opened orders.
if(OrdersTotal()==0)...
Count opened orders.
if(OrdersTotal()==0)...
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.
Thanks, its work. do you know where i can refer all this things with some example.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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);
}