Tester requotes with price-difference lower than given deviation

 

Do i have a knot in my brain, or is this bug?

Since today (never had this problem before), i get many requotes from the tester, where the price differs of just one point from the request, while the deviation is set to 10 points.

Do i really have to loop and retry until the diff is greater than the deviation?

Here is the log:

2022.01.22 09:46:29.070 Core 01 2021.03.25 03:36:27   requote 1.18051 / 1.18052 / 1.18051 (instant buy 0.2 EURUSD at 1.18051 sl: 1.17792 tp: 1.18462)
2022.01.22 09:46:29.070 Core 01 2021.03.25 03:36:27   requote 1.18051 / 1.18052 (instant buy 0.2 EURUSD at 1.18051 sl: 1.17792 tp: 1.18462)
2022.01.22 09:46:29.070 Core 01 2021.03.25 03:36:27   CTrade::OrderSend: instant buy 0.20 EURUSD at 1.18051 sl: 1.17792 tp: 1.18462 [requote (1.18051/1.18052)]
2022.01.22 09:46:29.070 Core 01 2021.03.25 03:36:27   CMyTrade::LogOrderResult: buy FAILURE. code=10004, description=requote (1.18051/1.18052)
2022.01.22 09:46:29.070 Core 01 2021.03.25 03:36:27   CMyTrade::LogDevVal: The request's deviation was: 10, One point is: 0.00001000

2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   instant sell 0.2 EURUSD at 1.21600 sl: 1.22115 tp: 1.21085 (1.21600 / 1.21702 / 1.21600)
2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   deal #4 sell 0.2 EURUSD at 1.21600 done (based on order #4)
2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   deal performed [#4 sell 0.2 EURUSD at 1.21600]
2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   order performed sell 0.2 at 1.21600 [#4 sell 0.2 EURUSD at 1.21600]
2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   CTrade::OrderSend: instant sell 0.20 EURUSD at 1.21600 sl: 1.22115 tp: 1.21085 [done at 1.21600]
2022.01.22 09:46:29.070 Core 01 2021.05.10 00:03:30   CMyTrade::LogOrderResult: sell success. code=10009, description=done at 1.21600

The code which produced these log-entries:

bool CMyTrade::Buy(double volume, double sl, double tp) {
    bool res = m_trade.Buy(volume, m_symbol.Name(), m_symbol.Ask(), sl, tp);
    LogOrderResult(res, "buy ");
    if(!res && m_trade.ResultRetcode() == TRADE_RETCODE_REQUOTE) {
        LogDevVal();
    }
    return(res);
}

bool CMyTrade::Sell(double volume, double sl, double tp) {
    bool res = m_trade.Sell(volume, m_symbol.Name(), m_symbol.Bid(), sl, tp);
    LogOrderResult(res, "sell ");
    if(!res && m_trade.ResultRetcode() == TRADE_RETCODE_REQUOTE) {
        LogDevVal();
    }
    return(res);
}

void CMyTrade::LogDevVal() {
    Print(__FUNCTION__, ": The request's deviation was: ", m_trade.RequestDeviation(), ", One point is: ", DoubleToString(m_symbol.Point()));
}

void CMyTrade::LogOrderResult(bool res, string type) {
    string myRes = (res) ? "success" : "FAILURE";
    Print(__FUNCTION__, ": ", type, myRes, ". code=", m_trade.ResultRetcode(), ", description=", m_trade.ResultRetcodeDescription());
}



 

Are you using a Strategy Tester Delay ?

 
Alain Verleyen #:

Are you using a Strategy Tester Delay ?

No, i don't use delay in the Tester.

Just for my understanding: How would a delay affect the "ignorance" of the deviation?

 
Thomas S. #:

No, i don't use delay in the Tester.

Just for my understanding: How would a delay affect the "ignorance" of the deviation?

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.


 
Thomas S.:

Do i have a knot in my brain, or is this bug?

Since today (never had this problem before), i get many requotes from the tester, where the price differs of just one point from the request, while the deviation is set to 10 points.

Do i really have to loop and retry until the diff is greater than the deviation?


I suppose "m_symbol" is an instance of SymbolInfo from the SL ? Are you using RefreshRates() correctly ?
 
Alain Verleyen #:
I suppose "m_symbol" is an instance of SymbolInfo from the SL ? Are you using RefreshRates() correctly ?

Many thanks for the info, didn't know this thread exists.

You're right, "m_symbol" is an instance of SymbolInfo (had to write a quick short example to test this and be prepared to post it here ;)

Reason: