HELP, failed cancel order [Invalid stops] problem!

 

test on EURUSD,H1 (netting) 2019.04.09 01:00:00 failed cancel order #21 buy limit 0.2 EURUSD at 1.12594 sl: 1.11994 tp: 1.12626 [Invalid stops] 2019.04.09 01:00:01 failed cancel order #21 buy limit 0.2 EURUSD at 1.12594 sl: 1.11994 tp: 1.12626 [Invalid stops] 2019.04.09 01:00:02 failed cancel order #21 buy limit 0.2 EURUSD at 1.12594 sl: 1.11994 tp: 1.12626 [Invalid stops] 2019.04.09 01:00:04 failed cancel order #21 buy limit 0.2 EURUSD at 1.12594 sl: 1.11994 tp: 1.12626 [Invalid stops] 2019.04.09 01:00:05 failed cancel order #21 buy limit 0.2 EURUSD at 1.12594 sl: 1.11994 tp: 1.12626 [Invalid stops]


This error is reported when I upload  EA of MT5 to MQL5. It does not appear when running normally.

And I don't understand, what does cancellation have to do with void stop loss?

Is there someone big enough to fix it?

 
You want someone else to fix YOUR code ?
 
In addition: there is no need to create pending orders in code.
  1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
  2. Don't worry about it unless you're scalping M1 or trading news.
  3. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
 
Alain Verleyen #:
You want someone else to fix YOUR code ?

I want to solve this problem, not necessarily need someone else to fix the code, I want to know the cause of the error, so I can fix it myself.

 
William Roeder #:
In addition: there is no need to create pending orders in code.
  1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
  2. Don't worry about it unless you're scalping M1 or trading news.
  3. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.

My EA is a night scalp and must use a sheet to reduce the effect of the slip point. But I don't understand why a withdrawal would be an invalid stops.

 
Edison Chen #:

I want to solve this problem, not necessarily need someone else to fix the code, I want to know the cause of the error, so I can fix it myself.

https://www.mql5.com/en/forum/386845

[invalid stops] during modification
[invalid stops] during modification
  • 2022.01.17
  • www.mql5.com
Hello, I find an Error during backtesting as shown in this pic While: and ModifySell has a similar code Note: I tried to enter Zero's instead of St...
 

thx,but this is not the same with my problem, and I did not report any error in the backtest, it was the error message given by the verification when EA uploading MQL5.

 
Edison Chen #:thx,but this is not the same with my problem, and I did not report any error in the backtest, it was the error message given by the verification when EA uploading MQL5.

That is because the validation test runs your EA against different broker conditions, and your code is most probably not doing the necessary checks.

That is way it reports that it cannot cancel an order due to invalid stops because you are not checking for Freeze Levels, Stop Levels, etc.

 
Edison Chen #:

thx,but this is not the same with my problem, and I did not report any error in the backtest, it was the error message given by the verification when EA uploading MQL5.

I can't be sure but I think that I have seen this problem before.

It happened when the EA tries to delete a pending order when the trigger price is too close to the current market price.

 
Keith Watford #: I can't be sure but I think that I have seen this problem before. It happened when the EA tries to delete a pending order when the trigger price is too close to the current market price.

Yes, that is called the "Freeze Level"!

... a freeze level is the minimum distance, measured from the current spot price (Bid/Ask), to be attained to trigger a temporary ban on modifying, deleting, or closing the orders, which are near to execution. Thus, a pending order, which is away from the current market price at a distance equal to or within the freeze level, cannot be modified, deleted, or prematurely closed.

 
Fernando Carreiro #:

这是因为验证测试会针对不同的代理条件运行您的 EA,而您的代码很可能没有进行必要的检查。

这就是它报告由于无效停止而无法取消订单的方式,因为您没有检查冻结水平、停止水平等。

thx, I've done all the validation in my code, including the Freeze Levels, Stop levels, etc.But the check is still wrong, I feel very confused!