if (Sellstop becomes sell) ....

To add comments, please log in or register
minh vu
38
minh vu  
if((iMA(NULL,0,89,0,MODE_EMA,PRICE_OPEN,0)>Bid))
     {
         result1=OrderSend( Symbol(),OP_BUY,Lots,Ask,Slippage,                    //--------------Order 1
                           SL1,
                           TP1,
                           Comment,MagicNumber,0,Red);
                OrderSelect(result1,SELECT_BY_TICKET);
                order1= OrderOpenPrice();                                         //Order 1 price 
                order2= order1 - expips*MyPoint;                                  //Order 2 price
                Alert("Entry 1: ",order1,". Entry 2: ",order2);         
         result2=OrderSend( Symbol(),OP_SELLSTOP,Lots,order2,Slippage,          //--------------Order 2
                           SL2,
                           TP2,
                           Comment,MagicNumber,0,Red);

         if(TotalOrdersCount()== 2 && totalpending() = 0)                       //Sellstop comes Sell
         {
            result3=OrderSend( Symbol(),OP_BUYLIMIT,Lots,order3,Slippage,        //--------------Order 3
                           SL3,
                           TP3,
                           Comment,MagicNumber,0,Blue);
            Alert("----------------Total: ",TotalOrdersCount(),". Pending: ",totalpending());
            
         }
     }
minh vu
38
minh vu  
I think if (TotalOrdersCount () == totalpending ()) { consider the current time But in fact, I need Buystop to run and become Buy So when considering If, the clause is false
William Roeder
18696
William Roeder  
Your highlighted condition is always false because you just opened a Sell Stop directly above.
minh vu
38
minh vu  
William Roeder:
Your highlighted condition is always false because you just opened a Sell Stop directly above.

I want the "if" segment to do when buystop becomes buy, what code I need

To add comments, please log in or register