0

Sometimes, particular in volatile markets, it happens that either after first or multiple attempts of Pending Stop order closure (stop buy or stop sell), I get error message "Modification is prohibited. The order is too close to the market." which causes that pending position cannot be closed. Upon multiple attempts of closure, the same error message can every time, after each attempt, occur again until position finally gets successfully closed. Since its pending stop position, i should protect myself against having this position executed while waiting for successful closure. What could i do to be sure that pending stop position, which MUST get as soon as possible closed, guaranteed WON'T be executed? Sometimes i am reattempting to close for several seconds, sometimes it can take even up to half minute or even entire minute. In this time i am getting very worried that pending stop could be executed instead of successfully closed. What can i do to somehow "block" execution of pending stop (buy or sell or both) position(s) that currently cannot be closed due to previously quoted error message? Thank you in advance.

Andrew0
  • 1
  • 5
  • no way. You can check whether the price is too close and do not even try to cancel a pending order. Alternative is to have stealth orders and check each second whether price reached them and send market order only in such cases (which of course means your slippage may increase) – Daniel Kniaz Mar 27 '19 at 18:59
  • I need to find some possibility to block execution of the pending order that cannot be closed due to the error quoted in the beginning of my first message. I assume that changing entry price wouldn't work either because price change (of that pending order) is still defined as "modification" just like closure is and the content of error says that modification is prohibited. Anyway, i have to find a way to block execution until closure is not successful. – Andrew0 Mar 27 '19 at 19:34
  • I believe after you sent a pending order to the broker, you have no control over it. You can send a request to kill that order, but the broker can reject your kill request, even if their `STOP_LEVEL` and `FREEZE_LEVEL` are zero. So if you really need that, I would suggest to have stealth orders. Pro: you can kill it even 1 tick before the price. Contra: you will have slippage. I believe there is no other way to solve the problem – Daniel Kniaz Mar 27 '19 at 21:23
  • can you please tell me what exactly do you define for "having stealth orders"? What is this? Application is placing two opposite stop pending orders for each chosen currency pair symbol. Once one get executed, another one gets automatically deleted by application but of course broker can "refuse" closure in case if order is currently too close to the market so it depends on market conditions and not on broker's restrictions at all. Application will repeatedly retry to close it until it gets closed successfully but i am worried to death that this pending order could get executed while it – Andrew0 Mar 27 '19 at 22:34
  • is automatically and repeatedly trying to be closed all the time until closed successfully. So please kindly explain me what "stealth orders" are, what is the logic behind them and example how do they work? Thank you in advance. – Andrew0 Mar 27 '19 at 22:34
  • The expert advisor has two levels, higher and lower ones. And it checks each tick whether they are greater then zero (if zero - ignore) and if higher level is equal or higher than the current `Ask` (same for lower/`Bid` pair). If higher is equal or higher market `OP_BUY' is sent to the market, once successful lower level is set to zero, and vice verse. If you need a code example I will do that, please let me know. – Daniel Kniaz Mar 27 '19 at 23:23
  • and how would this prevent pending stop position which cannot be closed and is repeatedly automatically trying (until successfully closed) to be closed as soon as possible, to NOT get executed? This is what we are talking about. If not possible directly then i need some quality solution (workaround) what could i do so while pending position is reattempting to be closed, it won't get executed. This is what i am afraid the most because one position (the one i want to be executed) for same symbol already gets executed. But i must do everything that other one won't get executed. – Andrew0 Mar 27 '19 at 23:48
  • You will not have a pending order sent to the broker's server. You will have the pending levels in the memory of the expert advisor, and once level is reached the expert would send a market order to the broker, killing another level – Daniel Kniaz Mar 28 '19 at 07:17
  • Daniel Kniaz, this (local orders) won't work because application is and must be placing "normal" pending stop buy and pending stop sell orders. Both orders for every wanted (ticked in checkboxes) symbol. If you have any other idea what to do, kindly let me know. There is no way to change order type. It would be against the logic of entire application. – Andrew0 Mar 29 '19 at 23:44

1 Answers1

1

Each broker have different limitation and restriction on the minimum distance where market/pending orders can be altered. You can see this in the Freeze Level in the contract specification: https://i.stack.imgur.com/zBY4Q.jpg

The full scope of the limitation is at: https://book.mql4.com/appendix/limits

If you are getting rejected, it means you are either (a) trading too near the market-price, or (b) your broker is setting the restrictions too far [meaning a bad broker].

There is no way to trade too near the market-edge and yet modify it. You need to respect the limitations/restriction of the broker OR change to another broker that cater to your requirements.

jlee88my
  • 2,935
  • 21
  • 28