MQL5 validation gives me this result, does anyone know why or how can I correct it?
test on EURUSD, H1 (netting) 2019.05.03 10:00:00 failed instant sell 1.4 EURGBP at 0.85750, close # 6 buy 1.4 EURGBP 0.85734 [Modification failed due to order or position being close to market]
2019.06.05 03:00:00 failed instant sell 1 EURCHF at 1.11689, close # 19 buy 1 EURCHF 1.11563 [Modification failed due to order or position being close to market]
strategy tester report 14 total trades
---
It seems that the problem comes from the TP update, which would be these lines:
The checks a trading robot must pass before publication in the Market
The article contains all the steps that you must implement in your code.
- www.mql5.com
The checks a trading robot must pass before publication in the Market
The article contains all the steps that you must implement in your code.
Following the article, runtime errors are expected to be printed through GetLastError (in this case ResultRetcode()). Already used but no solution.
You must correct your code. And an example of all the checks is given in the article. Have you read the article?
What's wrong in my code?
- Buying is done at the Ask price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Bid price.
- Selling is done at the Bid price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Ask price.
There is no check for the proximity of the price to the freeze level. There is no check for closeness of the price to the stop level ...
Please read the article. Is it really that hard to READ the article ???
I think I know what's the mistake, will check and get back to this thread.
There is a condition to modify stops, taking this (from the article) into account:
- Buying is done at the Ask price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Bid price.
- Selling is done at the Bid price — the TakeProfit and StopLoss levels must be at the distance of at least SYMBOL_TRADE_STOPS_LEVEL points from the Ask price.
You DO NOT have these checks - you get an error
Modification failed due to order or position being close to market
Please STUDY the article. Please USE the code from the article. The validator does a lot of checks - and the validator immediately throws bad code into the trash.
By the way, you can take the ready-made code from the article An attempt at developing an EA constructor
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
MQL5 validation gives me this result, does anyone know why or how can I correct it?
test on EURUSD, H1 (netting) 2019.05.03 10:00:00 failed instant sell 1.4 EURGBP at 0.85750, close # 6 buy 1.4 EURGBP 0.85734 [Modification failed due to order or position being close to market]
2019.06.05 03:00:00 failed instant sell 1 EURCHF at 1.11689, close # 19 buy 1 EURCHF 1.11563 [Modification failed due to order or position being close to market]
strategy tester report 14 total trades
---
It seems that the problem comes from the TP update, which would be these lines: