OrderSend error 4107

 

Hello community,

i'd like to ask if someone else encountered this weird error that can only appear during backtest (and not on demo or live): OrderSend error 4107.

The error should be related to:

  • Negative values in price, stoploss or takeprofit parameters of the  OrderSend() or OrderModify() function.
  • Unnormalized doubles in price, stoploss or takeprofit parameters of the  OrderSend() or OrderModify() function.

I tried to normalize those values and to print them during the backtest to check if there is something wrong but everything seems fine. And before it happens, the EA already opened and closed thousands of orders so it's very unlikely that the problems is in my code and to enforce my thought there is the fact that it doesn't happen always to the same point of backtest.

For example if i start backtest from january, the errors may happen at march. If i start from march (to see what's wrong at that point), the errors don't happen at the same point anymore but after few months again.

Sadly from the point the errors come, it's impossible to continue the backtest as it keep spamming that error.


Anyone has been able to find a solution to this?

Thanks.

     
    Francesco Grassi: Anyone has been able to find a solution to this?

    There is no solution because you don't even know what is wrong.

    Add some debug prints to your code, including _LastError and prices and find out why. Do you really expect us to debug your code for you?