Issue with failed orders (Invalid price, 10015 error code)

Dimitrios Vezeris  
I stumbled upon an issue during the development of an Expert Advisor and I was wondering if anyone had any idea that might help.

I get an "Invalid Price" error in backtest when the Expert Advisor tries to close a position on XAUUSD on a specific broker.
The error messages my Expert Advisor prints:
2018.05.16 18:05:40   failed market buy 0.15 XAUUSD, close #2 sell 0.15 XAUUSD 1321.220 [Invalid price]
2018.05.16 18:05:40   CTrade::OrderSend: market buy 0.15 XAUUSD [invalid price]
2018.05.16 18:05:40   *** FAILED Closing Position. Return code=10015. Code description: invalid price__ Invalid price
When I run the backtest with "Open prices only" the Expert Advisor opens a position at the beginning and never closes it until the end, while at the same time printing a lot of these error messages.

When I run the backtest with "OHLC Minute" or "Tick based on every tick" I still get a lot of these error messages but now the EA does manage to open and close several positions during the backtest period.

I use the 

bool CTrade::PositionClose(const ulong ticket,const ulong deviation)
method to close the position. I have tried both with unspecified deviation parameter and a specified deviation of big value and the result is exactly the same.
I also tested it on MT5 Version:5.00 build 1861 and on MT5 Version:5.00 build 1755, again with the same results.

I have also read everything on the forum about this error and checked that the execution mode for this symbol is "Market", both in the Symbol Description and from inside the Expert Advisor(SYMBOL_ORDER_MARKET).

This only happens for this specific broker on XAUUSD and on backtest(I have not checked on live trading). All other brokers and symbols I have checked(of various execution modes) do not show the same problem.

Do you have any idea about what could be causing it?
Dimitrios Vezeris  
Alain Verleyen:
Which broker ?

The broker is ForexTime.

Dimitrios Vezeris  
Alain Verleyen:

It's an MT5 bug.

XAUUSD tick size is 0.01 on this broker

But the strategy tester returns ticks with prices like 1310.291.

You need to report this to your broker and write to Metaquotes ServiceDesk.

Yes, this seems to be the problem. Thank you.

We have reported the issue and we'll keep you posted for anything new.

Uche Celestine Obi  
CFDs on Activetrades and Fxpro is having same issue.