Help with this Error: Error opening Sell order: (130) invalid stops

 

Hello guys,

Someone could please help me to fix the code above?

Already tried many things and read many posts also.... unfortunately without results :(

It's showing this Error:

2015.10.22 15:06:44.235    MA_Cross EURUSD,M1: Error opening Sell order [MA_Cross EURUSD_PERIOD_M1]: (130) invalid stops


//+------------------------------------------------------------------+
//| Open BuyStop                                                     |
//| Open a new trade using Buy Stop                                  |
//| If Stop Loss or TakeProfit are used the values are calculated    |
//| for each trade                                                   |
//+------------------------------------------------------------------+
void OpenBuyStopOrder()
{
   int err,ticket;
   double myStopLoss = 0, myTakeProfit = 0;                 
  
   double LongTradeRate = Ask + BreakOutLevel*Point;
   myStopLoss = 0;
 
   if ( StopLoss > 0 ) myStopLoss = LongTradeRate-Point*StopLoss ;  
   myTakeProfit = 0;
   if (TakeProfit> 0 ) myTakeProfit = LongTradeRate+Point*TakeProfit;

     ticket=OrderSend(Symbol(),OP_BUYSTOP,lotMM,LongTradeRate,0,myStopLoss,myTakeProfit,setup,MagicNumber,0,Green);
     if(ticket<=0)
   {
      err = GetLastError();
      Print("Error opening BUY STOP order [" + setup + "]: (" + err + ") " + ErrorDescription(err));
   }
}

//+------------------------------------------------------------------+
//| Open SellStop                                                    |
//| Open a new trade using Sell Stop                                 |
//| If Stop Loss or TakeProfit are used the values are calculated    |
//| for each trade                                                   |
//+------------------------------------------------------------------+
void OpenSellStopOrder()
{
   int err, ticket;
   double myStopLoss = 0, myTakeProfit = 0;                          
  
   double ShortTradeRate = Bid - BreakOutLevel * Point;
   myStopLoss = 0;
  
   if ( StopLoss > 0 ) myStopLoss = ShortTradeRate+Point*StopLoss ;  
   myTakeProfit = 0;
   if (TakeProfit > 0) myTakeProfit = ShortTradeRate-Point*TakeProfit;
   ticket=OrderSend(Symbol(),OP_SELLSTOP,lotMM,ShortTradeRate,0,myStopLoss,myTakeProfit,setup,MagicNumber,0,Red);
   if(ticket<=0)
   {
      err = GetLastError();
      Print("Error opening Sell order [" + setup + "]: (" + err + ") " + ErrorDescription(err));
   }
}

 

It means it is below the Broker's Stop Level minimum.

Print("Stop level in points=",MarketInfo(Symbol(),MODE_STOPLEVEL));