Hi All
i am trying to place orders OP_SELLSTOP at hour() higher than the current price and OP_BUYSTOP lower than current price in an EA.
double down = Open[0]-400*Point;
double up = Open[0]+400*Point;
Ticket=OrderSend(Symbol(),OP_BUYSTOP,ILots,down,Slippage,SL,TP,EAName,Magic,0,Blue);
Ticket=OrderSend(Symbol(),OP_SELLSTOP,ILots,up,Slippage,SL,TP,EAName,Magic,0,Red);
of course i am getting (OrderSend error 130)
is there a way how to place these orders?
if somebody can help
Happy New Year to All
Anthony
Hi Anthony
Please see below a description from the MQL book on the 130 error:
ERR_INVALID_STOPS | 130 | Stops are too close, or prices are ill-calculated or unnormalized (or in the open price of a pending order). The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed. |
You get error 130 for 2 reasons as you cab see here.
1) Your stoploss or take profit levels are to close to the current price.
2) You are trying to place a pendng order to close to the current price.
You can check what the minimum distance is by using the MarketInfo() function along with MODE_STOPLEVEL.
Make sure your order is correctly specified. Once it is, it will be accepted by the terminal.
whocares
Hi Anthony
Please see below a description from the MQL book on the 130 error:
ERR_INVALID_STOPS | 130 | Stops are too close, or prices are ill-calculated or unnormalized (or in the open price of a pending order). The attempt can be repeated only if the error occurred due to the price obsolescense. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed. |
You get error 130 for 2 reasons as you cab see here.
1) Your stoploss or take profit levels are to close to the current price.
2) You are trying to place a pendng order to close to the current price.
You can check what the minimum distance is by using the MarketInfo() function along with MODE_STOPLEVEL.
Make sure your order is correctly specified. Once it is, it will be accepted by the terminal.
whocares
Thanks whocares
i am not using SL or TP, and the order to be placed 40 pips away from current price., even if i use 100 pips, same error i am getting.
if i switch the OP_SELLSTOP in place of OP_BUYSTOP, the order works fine without errors.
my aim is to put the buy pending order under the current price, and sell pending order over current price.
Thanks
Anthony
Thanks whocares
i am not using SL or TP, and the order to be placed 40 pips away from current price., even if i use 100 pips, same error i am getting.
if i switch the OP_SELLSTOP in place of OP_BUYSTOP, the order works fine without errors.
my aim is to put the buy pending order under the current price, and sell pending order over current price.
Thanks
Anthony
Try replacing the BUYSTOP with BUYLIMIT and the SELLSTOP with SELLLIMIT.
Also make sure that the 40 pips is infact not 4 pips. Is you ea correctly dealing with a 5 digit price from the broker as opposed to the traditional 4 digit price.
whocarres
Try replacing the BUYSTOP with BUYLIMIT and the SELLSTOP with SELLLIMIT.
Also make sure that the 40 pips is infact not 4 pips. Is you ea correctly dealing with a 5 digit price from the broker as opposed to the traditional 4 digit price.
whocarres
Hi whocares
Yes, i did not pay attention for that, it worked fine with BUYLIMIT and SELLLIMIT.
Thank you
Anthony
Yes, i did not pay attention for that, it worked fine with BUYLIMIT and SELLLIMIT.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All
i am trying to place orders OP_SELLSTOP at hour() higher than the current price and OP_BUYSTOP lower than current price in an EA.
double down = Open[0]-400*Point;
double up = Open[0]+400*Point;
Ticket=OrderSend(Symbol(),OP_BUYSTOP,ILots,down,Slippage,SL,TP,EAName,Magic,0,Blue);
Ticket=OrderSend(Symbol(),OP_SELLSTOP,ILots,up,Slippage,SL,TP,EAName,Magic,0,Red);
of course i am getting (OrderSend error 130)
is there a way how to place these orders?
if somebody can help
Happy New Year to All
Anthony