mismatched stoploss help?

 

Hi, so I'm currently in the middle of writing a code that requires a minimum stop loss allowed, and so have:

ticket1=OrderSend(Symbol(),OP_BUY,volume,Ask,0,0,0,"",magic,Blue);
OrderSelect(ticket1,SELECT_BY_TICKET); btake=(OrderOpenPrice()+(level*adjusted_pips)); blimit=MarketInfo(Symbol(),MODE_STOPLEVEL);
if (OrderStopLoss()==0)
   {
   for (count=0;count<=0;count++)
      {
      stop=OrderModify(OrderTicket(),OrderOpenPrice(),(OrderOpenPrice()-(blimit*Point)),0,0,Green);    
      if (stop==false)
         {
         blimit++; count--;
      }
   }
}
ticket2=OrderSend(Symbol(),OP_SELL,volume,Bid,0,0,0,"",magic,Red);
OrderSelect(ticket2,SELECT_BY_TICKET); stake=(OrderOpenPrice()-(level*adjusted_pips)); slimit=MarketInfo(Symbol(),MODE_STOPLEVEL);
if (OrderStopLoss()==0)
   {
   for (count=0;count<=0;count++)
      {
      stop=OrderModify(OrderTicket(),OrderOpenPrice(),(OrderOpenPrice()+(slimit*Point)),0,0,Green);
      if (stop==false)
         {
         slimit++; count--;
      }
   }  
}
OrderSelect(ticket1,SELECT_BY_TICKET,MODE_HISTORY);
Print((OrderOpenPrice()-OrderClosePrice())/adjusted_pips);
OrderSelect(ticket2,SELECT_BY_TICKET,MODE_HISTORY);
Print((OrderOpenPrice()-OrderClosePrice())/adjusted_pips);

and know my brokers minimum limit is 12.5 pips. My buy order comes out with 12.5 pip difference as expected whilst backtesting, but my sell order prints out -18.2 - even accounting for a spread of 2 pips I cant see where this has come from, the slimit pippette counter doesnt move, and am confused as to where discrepancy has come from? Have I missed something obvious?

 
You Buy at the Ask, your SL is relative to the Bid. the difference is the spread(wrong open)+spread(right open) spread.
//   stop=OrderModify(OrderTicket(),OrderOpenPrice(),(OrderOpenPrice() -(blimit*Point)),0,0,Green);  
     stop=OrderModify(OrderTicket(),OrderOpenPrice(),(OrderClosePrice()-(blimit*Point)),0,0,Green);  
 
WHRoeder:
You Buy at the Ask, your SL is relative to the Bid. the difference is the spread.

I had considered that, I had in previous iterations changed OrderOpenPrice()+(slimit*Point) to Ask+(slimit*Point) but it made no difference?