Is the market EA verification performed using zero latency?

 

During my backtesting, I encounter a few invalid stop errors when using the "random delay" setting. However, when I switch to the "zero latency, ideal execution" setting, the test runs error-free. Could this inconsistency be attributed to slippage issues arising from trade execution speed? If so, how can I mitigate these issues?

My objective is to develop a template that successfully clears the automatic verification process for the marketplace. Does the verification process employ zero latency settings? If that's the case, will the current discrepancy in error occurrences affect my template's verification results?


more information: https://www.mql5.com/en/forum/444428/page2

[Invalid Stops]- Print("Stop Level is: ", stops_level); returning 0
[Invalid Stops]- Print("Stop Level is: ", stops_level); returning 0
  • 2023.04.05
  • www.mql5.com
Hello, I am encountering the "Invalid Stops" error message in my EA code. After conducting a check, the value that is being returned is 0...
 
Rafael Santos: During my backtesting, I encounter a few invalid stop errors when using the "random delay" setting. However, when I switch to the "zero latency, ideal execution" setting, the test runs error-free. Could this inconsistency be attributed to slippage issues arising from trade execution speed? If so, how can I mitigate these issues? My objective is to develop a template that successfully clears the automatic verification process for the marketplace. Does the verification process employ zero latency settings? If that's the case, will the current discrepancy in error occurrences affect my template's verification results? more information: https://www.mql5.com/en/forum/444428/page2

If your code is still getting the invalid stop errors with random delay, then it still has bugs and is not robust enough.

I suggest either using the debugger, or adding extra debug prints in your code to report conditions when the error occurs. In your code you should check the status and trade return code and report it in the log alongside with all the conditions at the time.

 
Fernando Carreiro #:

If your code is still getting the invalid stop errors with random delay, then it still has bugs and is no robust enough.

I suggest either using the debugger, or adding extra debug prints in your code to report conditions when the error occurs. In your code you should check the status and trade return code and report it in the log alongside with all the conditions at the time.

Hello Fernando! Thank you so much for your prompt response. Based on your suggestions, I will delve deeper into the debugging process to pinpoint the root cause of the issue. I'm aware that there are instances where the automatic verification allows for certain errors, and I was wondering if this might be one of those cases. Nonetheless, if the issue isn't related to slippage due to execution speed, I wholeheartedly agree that further debugging is the most prudent course of action.

For future reference, are you able to guide me on where I can verify the latency settings used during the automatic verification process?

Warm regards,

 
Rafael Santos #: Hello Fernando! Thank you so much for your prompt response. Based on your suggestions, I will delve deeper into the debugging process to pinpoint the root cause of the issue. I'm aware that there are instances where the automatic verification allows for certain errors, and I was wondering if this might be one of those cases. Nonetheless, if the issue isn't related to slippage due to execution speed, I wholeheartedly agree that further debugging is the most prudent course of action. For future reference, are you able to guide me on where I can verify the latency settings used during the automatic verification process?

Your primary concern should be to make your code "bug-free" and robust. The verification process is secondary.

Your code must be able to cope with any market condition or contract specifications without fail. I am not referring to profits. I am referring to code and execution robustness.

As for latency in the verification process, you have no control over that. It is a "black box". It simulates various conditions that are unknown to us, and your code must be able to handle them.

 

I don't think the validation process use any delay, but I am not sure. You should just check by yourself.

 

About Strategy Tester "Random delay". I didn't check recently but here is what I was experimenting in the past.

Forum on trading, automated trading systems and testing trading strategies

MT5/mql5 reported and confirmed bugs.

Alain Verleyen, 2021.08.23 18:05

MT5 build 3021 beta, Strategy Tester with "Random delay", wrongly trigger requote error. MeteQuotes-demo server.

Instant execution is used, so "Deviation" parameter should work and requote only occurs when the maximum deviation (100 points) is exceeded.

But a slippage of 6 points results in a requote. This is a bug.


 
Fernando Carreiro #:

Your primary concern should be to make your code "bug-free" and robust. The verification process is secondary.

Your code must be able to cope with any market condition or contract specifications without fail. I am not referring to profits. I am referring to code and execution robustness.

As for latency in the verification process, you have no control over that. It is a "black box". It simulates various conditions that are unknown to us, and your code must be able to handle them.

Thank you for emphasizing the critical aspects of code robustness and execution stability. I concur that the primary focus should be on ensuring the code is bug-free, and can adeptly handle a diverse range of market conditions and contract specifications. The verification process, although important, should be a secondary consideration.

I appreciate your clarification about the latency in the verification process being akin to a "black box." I understand it simulates various undisclosed conditions, and it's crucial for my code to be versatile and resilient in such scenarios. I will keep these factors in mind as I work diligently to optimize and refine my strategy.

Once again, thank you for your invaluable guidance and expertise.

 
Alain Verleyen #:

I don't think the validation process use any delay, but I am not sure. You should just check by yourself.

Will do, thank you for all your help!

 
Alain Verleyen #:

About Strategy Tester "Random delay". I didn't check recently but here is what I was experimenting in the past.


Your insights regarding the invalid requote during random latency back testing are appreciated. While this may be contributing to the issues I'm experiencing with my testing, I'm still trying to understand why the system generates an invalid stop loss when my stop loss parameters are set at 3,000 points away from the entry price. could a slippage of 6 or even 100 points in price cause this error?

From what I understand about slippage vs requotes,  it seems that my issue is more likely related to slippage, as it can indeed affect stop loss and take profit levels. Conversely, requotes typically only impact the entry price. Slippage occurs when the execution price of an order differs from the requested price, which can be caused by market volatility or low liquidity, leading to variations in stop loss and take profit levels.

Requotes are a refusal to open an order at the current market price (the price has changed since the trading order was issued by the terminal to the server, for example).

Slippage (slippage) - this is opening/closing from the market or even the cancellation of the order at the wrong price, which was set in the open/close parameter (there was no such price - it jumped over your stop or take).

Following your advice and Fernando's recommendations, I will conduct further debugging to investigate this issue more thoroughly. Once I feel that the system is ready, I will also try the auto-verification my self.

Your assistance is very helpful, and I am grateful for your support. Thank you again, Alain.

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trade Operation Types - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Rafael Santos #: I'm still trying to understand why the system generates an invalid stop loss when my stop loss parameters are set at 3,000 points away from the entry price. could a slippage of 6 or even 100 points in price cause this error?

It may not be a question of "distance", but that the price is not aligned to the tick size.

Please read the following post for more details ... https://www.mql5.com/en/forum/440541#comment_44621992

How to handle price calculations for different asset classes?
How to handle price calculations for different asset classes?
  • 2023.01.26
  • www.mql5.com
Hi, I want to run an EA in strategy tester with different symbols/asset-classes at once, therefore I want to have one set of optimization settings...