Expert Advisor Code Not working, what am missing?

 

The below code not executing the sellstop order.  What is that am missing?  I want the sell stop to get executed once the buy order is placed.

trade.Buy(0.10,Symbol(),SymbolInfoDouble(Symbol(),SYMBOL_ASK),0,0,commStr);
if(count_buys==1){
trade.SellStop(0.10,(SymbolInfoDouble(Symbol(),SYMBOL_BID)-5),Symbol(),0,0,ORDER_TIME_GTC,0,commStr);
}

The above executes only the Buy order.  If am using as below, it executes both the order

trade.Buy(0.10,Symbol(),SymbolInfoDouble(Symbol(),SYMBOL_ASK),0,0,commStr);
//if(count_buys==1){
trade.SellStop(0.10,(SymbolInfoDouble(Symbol(),SYMBOL_BID)-5),Symbol(),0,0,ORDER_TIME_GTC,0,commStr);
//}

How to correct this code?

 
Sathish Justin:

...
How to correct this code?

Hello,

You need to check how "count_buys" gets the numbers.

if(count_buys==1)
 
Yohana Parmi #:

Hello,

You need to check how "count_buys" gets the numbers.

Hi,

Thanks, there is a error in the count_buys which i corrected and now its working

 
Sathish Justin #:

Hi,
Thanks, there is a error in the count_buys which i corrected and now its working

Happy coding :)

Reason: