Getting Error during Backtesting in MT5: ERROR: Server error. Sending order to server again

To add comments, please log in or register
Abhay Agarwal
708
Abhay Agarwal  

Hi,

Does anyone know the reason for the error during backtestign in MT5


"ERROR: Server error. Sending order to server again"


My code is correct as I can backtest without problems for periods Sep'17 - Jan'18 but when I am trying to backtest for futures data from Jan'17 - Mar'17, then it is giving me this error.

When I test visually, then it does show the chart data but gives error when placing the order.

Alain Verleyen
38033
Alain Verleyen  
Abhay Agarwal:

Hi,

Does anyone know the reason for the error during backtestign in MT5


"ERROR: Server error. Sending order to server again"


My code is correct as I can backtest without problems for periods Sep'17 - Jan'18 but when I am trying to backtest for futures data from Jan'17 - Mar'17, then it is giving me this error.

When I test visually, then it does show the chart data but gives error when placing the order.

Are you sure this message doesn't come from your code ? I am almost sure it is.

Backtesting without problem on an other period doesn't mean you can't have this error on an other period.

Abhay Agarwal
708
Abhay Agarwal  
Alain Verleyen:

Are you sure this message doesn't come from your code ? I am almost sure it is.

Backtesting without problem on an other period doesn't mean you can't have this error on an other period.


Ok, it is coming from my code, but on these conditions:

         if(errorcode_bn==TRADE_RETCODE_CONNECTION 

             || errorcode_bn==TRADE_RETCODE_TIMEOUT

             || errorcode_bn==TRADE_RETCODE_INVALID_PRICE

             || errorcode_bn==TRADE_RETCODE_PRICE_OFF

             || errorcode_bn==TRADE_RETCODE_PRICE_CHANGED

             || errorcode_bn==TRADE_RETCODE_REQUOTE

             || errorcode_bn==TRADE_RETCODE_REJECT

             || errorcode_bn==TRADE_RETCODE_ERROR

             || errorcode_bn==TRADE_RETCODE_INVALID

             || errorcode_bn==TRADE_RETCODE_INVALID_VOLUME

             || errorcode_bn==TRADE_RETCODE_INVALID_STOPS

             || errorcode_bn==TRADE_RETCODE_INVALID_FILL

           ) 


Again my code is correct as it runs on other periods...

Alain Verleyen
38033
Alain Verleyen  
Abhay Agarwal:

Again my code is correct as it runs on other periods...

No it's not, as it gives you a useless error message.

Check what is the exact error and manage it, the above errors are very different.

Abhay Agarwal
708
Abhay Agarwal  
Alain Verleyen:

No it's not, as it gives you a useless error message.

Check what is the exact error and manage it, the above errors are very different.

Ok In Backtesting for the expired futures symbol, it gives the error:

ErrorCode: TRADE_RETCODE_INVALID_FILL

It was working fine until 1 or 2 days  ago.

Abhay Agarwal
708
Abhay Agarwal  
Abhay Agarwal:

Ok In Backtesting for the expired futures symbol, it gives the error:

ErrorCode: TRADE_RETCODE_INVALID_FILL

It was working fine until 1 or 2 days  ago.

For everyone's benefit, the issue was resolved by setting in the code, trade.setfillingtype(ORDER_FILLING_RETURN) , just before calling trade.PositionOpen request..

Alain Verleyen
38033
Alain Verleyen  
Abhay Agarwal:

For everyone's benefit, the issue was resolved by setting in the code, trade.setfillingtype(ORDER_FILLING_RETURN) , just before calling trade.PositionOpen request..

Yes and the next time it will change (the filling type allowed), you will get an error again.
To add comments, please log in or register