Invalid stop

 
Can anyone point me why my EA generates an error 130 which is invalid stop loss for this particular trade (and every other shorts i'm trying to OrderSend)

Here is the screenshot of my trade:
http://img231.imageshack.us/my.php?image=60364059ls0.png


Here is code for EA:

//+------------------------------------------------------------------+
 
//|                                                GoldenFifties.mq4 |
 
//|                                                 mjollnir / beebo |
 
//|                                                     ircforex.com |
 
//+------------------------------------------------------------------+
 
#property copyright "mjollnir (monsieur.burns [AT] toutatis dot be) / beebo"
 
#property link      "ircforex.com"
 
 
 
#define LOT_SIZE     1
 
 
 
// Params
 
extern double        pips_delta;
 
extern double        sl;
 
extern double        tp;
 
 
 
// Own vars
 
// Date
 
int      cur_day;
 
// Quotes
 
double   prev_day_low;
 
double   prev_day_high;
 
double   prev_day_average;
 
double   cur_day_low;
 
double   cur_day_high;
 
 
 
static int order_id=0;
 
static int ticket;
 
static bool is_in_trade=false;
 
static bool is_first_day=true;
 
 
 
int init()
 
  {
 
  
 
   return(0);
 
  }
 
 
 
 
 
int deinit()
 
  {
 
 
 
 
 
   return(0);
 
  }
 
 
 
int start()
 
  {
 
   int i, j;
 
   int limit, counted_bars=IndicatorCounted();
 
   // Don't recalc previous bars
 
   if(counted_bars>0) counted_bars--;
 
   limit=Bars-counted_bars;
 
 
 
   // Discard sundays!
 
   if(DayOfWeek()==0)
 
      {
 
      return(0);
 
      }
 
 
 
   // Is this a new day?
 
   if(Day()!=cur_day)
 
      {
 
      // Close current trade if there is one
 
      close_trade();
 
      
 
      // Yes, lets update prev_day vars
 
      update_prev_day();
 
      // Reset cur vars
 
      reset_cur_day();
 
      }
 
   
 
   // Continue with
 
   update_cur_day();
 
   
 
   // Trading allowed?
 
   if(OrdersTotal()==0)
 
      {
 
      // Check if we downcross 50% fib of yesterday.
 
      is_long_entry();
 
      // Check for upcross
 
      is_short_entry();
 
      }
 
   
 
   return(0);
 
  }
 
 
 
void update_prev_day()
 
{
 
   prev_day_low=cur_day_low;
 
   prev_day_high=cur_day_high;
 
   prev_day_average=prev_day_low+(prev_day_high-prev_day_low)/2;
 
   // Round price to remove trailing numbers from average calc
 
   prev_day_average-=MathMod(prev_day_average, Point);
 
      
 
   Print("Prev day ("+GetYesterdayTime()+") values: Low@"+prev_day_low+" High@"+prev_day_high+" Avg@"+prev_day_average);
 
   
 
}
 
 
 
void reset_cur_day()
 
{
 
   cur_day=Day();
 
   cur_day_low=Bid;
 
   cur_day_high=Bid;
 
}
 
 
 
void update_cur_day()
 
{
 
   cur_day_low=MathMin(Low[0], cur_day_low);   
 
   cur_day_high=MathMax(High[0], cur_day_high);
 
}
 
 
 
string GetCurTime()
 
{
 
   string str;
 
   str=TimeToStr(TimeCurrent(), TIME_DATE);
 
   str=str+" "+TimeToStr(TimeCurrent(), TIME_SECONDS);
 
   return(str);
 
}
 
 
 
string GetYesterdayTime()
 
{
 
   string str;
 
   str=TimeToStr(TimeCurrent()-86400, TIME_DATE);
 
   str=str+" "+TimeToStr(TimeCurrent()-86400, TIME_SECONDS);
 
   return(str);
 
}
 
 
 
void is_long_entry()
 
{
 
   if(Close[0]<prev_day_average && Close[1]>prev_day_average)
 
      {
 
      
 
      // Yes, we enter long.
 
      double buy_price=prev_day_average-(pips_delta)*Point;
 
      //buy_price=Ask+pips_delta*Point; only good for live
 
     
 
      
 
      // Calc sl and tp
 
      double stop_loss=buy_price-sl*Point;
 
      double take_profit=buy_price+tp*Point;
 
      
 
      Print("bp: "+buy_price+" sl: "+stop_loss+" tp: "+take_profit+ " point: "+Point);
 
      
 
      ticket=OrderSend(Symbol(),OP_BUYLIMIT,LOT_SIZE,buy_price,3,stop_loss,take_profit,"GoldenFifties order #"+order_id,16984,0,Green);
 
      
 
      if(ticket<0)
 
         {
 
         Print("OrderSend failed with error #",GetLastError());
 
         return(0);
 
         }
 
         
 
      is_in_trade=true;
 
      order_id++;
 
      
 
      }
 
}
 
 
 
void is_short_entry()
 
{
 
   if(Close[0]>prev_day_average && Close[1]<prev_day_average)
 
      {
 
 
 
      // Yes, we enter short.
 
      Print("Let's short");
 
      double sell_price=prev_day_average+(pips_delta)*Point;
 
 
 
      // Calc sl and tp
 
      double stop_loss=sell_price+sl*Point;
 
      double take_profit=sell_price-tp*Point;
 
 
 
      Print("sp: "+sell_price+" sl: "+stop_loss+" tp: "+take_profit+ " point: "+Point);
 
 
 
      int ticket=OrderSend(Symbol(),OP_SELLLIMIT,0.1,sell_price,3,stop_loss,take_profit,"GoldenFifties order #"+order_id,16984,0,Green);
 
 
 
      if(ticket<0)
 
         {
 
         Print("OrderSend failed with error #",GetLastError());
 
         return(0);
 
         }
 
 
 
      is_in_trade=true;
 
      order_id++;
 
 
 
      }
 
}
 
 
 
void close_trade()
 
{
 
bool result;
 
 
 
   if(OrdersTotal()!=0)
 
      {
 
      Print("EOD: closing trade");
 
      result=OrderClose(ticket,LOT_SIZE,Ask,3,Red);
 
      if(result==false)
 
         {
 
         Print("OrderClose() error: "+GetLastError());
 
         }     
 
      }
 
}