Error 130 - invalid stop. Why? - page 7

 
mladen:
Try opening the orders without stop loss and take profit If you do not get an error then, than it means that your broker is ECN/STP type of broker and that you have to open an order without sl and tp, and then modify an already opened order to desired sl and tp

Hello again Mladen, i have tried that and still nothing.

 
rg83:
Hello again Mladen, i have tried that and still nothing.

rg83

Plase take a look at the code I have posted for you yesterday

You can not use values like 360 and 80 for stop loss or take profit

They are calculated as open price +- stop loss (or take profit)*point (pip) value. The reason why I moved your post at this thread is because you have some very good examples and explanations here how you have to handle sl and tp

 

I did use the code you provided and it still did not resolve the issue. At some point along the way I did manage to get the EA to place trades but I have adjusted it again and now I cant get back to placing trades.

 
rg83:
I did use the code you provided and it still did not resolve the issue. At some point along the way I did manage to get the EA to place trades but I have adjusted it again and now I cant get back to placing trades.

The code that I have posted resulted in opening orders like this :

Please use that code as a model, since it is opening orders as it should

Files:
tester.gif  70 kb
 

//+------------------------------------------------------------------+ //| Tester.mq4 | //| | //+------------------------------------------------------------------+ #include extern int dist2=6; extern int SignalBar=2; input double lots=3; input double TakeProfit=3; input double StopLoss=1; int OpenOrders=0, cnt=0; int start() { bool uptrend=iCustom(NULL,0,"super_signals_v2_alert",1,1)!=EMPTY_VALUE; bool downtrend=iCustom(NULL,0,"super_signals_v2_alert",1,1)!=EMPTY_VALUE; Comment(uptrend," ",downtrend); if(downtrend) { bool ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,2,StopLoss*Point,TakeProfit*Point,NULL,0,0,clrRed); } else if(uptrend) { ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,2,StopLoss*Point,TakeProfit*Point,NULL,0,0,clrGreen); } return(0); }

Still the same issue sasdly

 

Try the following : try to open an order manually and to place some top loss immediately while you are opening the order (like on the picture and see what will happen with the order

Files:
new_order.gif  23 kb
 

short with SL 35+pips is ok, anything else is invalid.

 

It is 35 points

So your minimal stop loss is 35 points (3.5 pips) per moment for the symbol you are trying to open that order on. You have to use stop loss and take profit that is at least 35 points greater (smaller) than the open price and then it should work

Minimal stop loss distance is specific for symbols so you have to adjust it for each symbol. Information what is the minimal stop loss distance can be obtained using MarketInfo(Symbol(),MODE_STOPLEVEL) which will return the minimal level in points and you can use that value to adjust your stop loss and /or take profit

 

I have tried putting those figures in as the SL but I still get the same error

 
rg83:
I have tried putting those figures in as the SL but I still get the same error

rg83

Please read this post : https://www.mql5.com/en/forum/general

Reason: