error 130 - Invalid stops

 
I have a problem of frequent error 130 - Invalid stops.

Does anybody else have the same problem or know how to remedy it? Are there limitations to how wide the stop can be set, or are very large stops possible?


...
extern double Stop_Loss=50;
extern double Limit_1a=25; 
extern double Slippage=5;
extern double Lots = 0.5;
...
static double Trend;
...


 //TRADES IN UPTREND 	
      if
      (
      Trend==1 //condition 1a for trading
      )    
      
        {	     
        ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-Stop_Loss*Point,Ask+Limit_1a*Point," ",123,0,Blue);
        Print("Buy_1a:"); 
        if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            {Print("BUY order opened: ",OrderOpenPrice());}
           }
         else Print("Error opening BUY order: ",GetLastError()); 
         return(0); 
         }
...
 
i am still getting a lot of errors, even with the upgraded versions. could this be a result of running several MT4s out of different directories?

has anyone similar problems? i recommend to print eventual errors when you buy/sell and check your logs! feedback would be most helpful.
 
May be "Bid-Stop_Loss*Point" instead of "Ask-Stop_Loss*Point"?
 
hello slawa,

thank you for the suggestion. i tried, and also changed the selling positions to 'Ask' for stoploss. to no avail - i still get error 130s very often (i don't see a particular pattern, sometimes it trades, sometimes it does not).

i also tried other programs that take several trades within a candle, and also get error 130, not all the time but it happens.

i would appreciate if you could look into this, or i can send a whole EA for testing.
 
How near from MarketInfo(Symbol(),MODE_STOPLEVEL) value are your Stop_Loss and Limit_1a values?
 
Thank you for the hint! It looks like the problem was not the stops but that limits were too close to the starting price.

:)
Reason: