Open opposite order

 

Hi all,

 

I need to open an order apart other x pips. for that I though to use this kind of function, but seems it do not work properly.  Is that possible take from you some help ?

extern int OppositeDistance  =  2;

 

 if(BuyAllowed )    
          {//  
            RefreshRates();                               
            BuyTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage*pips2points,0,0,"Initial Buy Order",MagicNumber,0,Green);               
            if(BuyTicket > -1)     
             {//
               AddLimitsBuy();
               BuyAllowed = false;SellAllowed = true;           
             {// 
            if(SellAllowed)
              {//      
                SellTicket = OrderSend(Symbol(),OP_SELLSTOP, MLots,Bid - OppositeDistance * pips2dbl,Slippage * pips2points,0,0,"",MagicNumber,0,Green);
                if(SellTicket > -1)
                 {//
                   AddLimitsSell();
                   BuyAllowed = true;SellAllowed = false;
                 }//
               }//            
             }//                                                                                             
           }//     
       return(0);
        }//

 

Thank you in advance.

Luis 

 
I believe you mistyped the closing curly bracket and forgot additional one in the BuyTicket block.