Failed modify position Stop Loss on real account, but never in backtests

 
I've activated my EA on using the MT5 VPS and it created a position on Bitcoin but it failed to set the Stop Loss which is strange because the EA never failed during all my backtests.
I had to set manually a SL to the level that the EA expected, and that worked.

The algorithm opens a position and subsequently modifies the SL and TP.
Looking at the logs below I can see that the price returned when opening the position is 0, which never happens during the backtests. This looks like a bug or something very unusual.
I don't know whether that is the reason why the Modify position failed, because I re-read the open price for the new position again and I use that to compute the SL, which has been correctly computed to  10994.93.


2020.08.05 22:45:44.636 EA (Bitcoin,D1) DECISION: TradeVolume = 0.20, StopLossPoints = 69183
2020.08.05 22:45:44.673 EA (Bitcoin,D1) Open buy order #1383083: 10009 - Request is completed, Volume: 0.2,  Price: 0.0
2020.08.05 22:45:44.673 EA (Bitcoin,D1) Alert: Modify position: Error 10013 - Invalid request
2020.08.05 22:45:44.673 EA (Bitcoin,D1) MqlTradeRequest - action:6, symbol:, volume:0.0, price:0.0, sl:10994.93, tp:0.0, stoplimit:0.0, comment:, deviation:0, expiration:1970.01.01 00:00:00, magic:0, order:0, position:1383083, position_by:0, type:0, type_filling:0, type_time:0
2020.08.05 22:45:44.673 EA (Bitcoin,D1) MqlTradeResult - ask:0.0, bid:0.0, comment:Invalid request, deal:0, order:0, price:0.0, request_id:0, retcode:10013, retcode_external:0, volume:0.0
2020.08.05 22:45:44.673 EA (Bitcoin,D1) Modify position #1383083: 10013 - Invalid request, SL: 10994.93, TP: 0.0, Bid: 11676.76, Ask: 11686.76, Stop Level: 0


Can you advise?


Thanks

Marco

 


Can you advise

Ok, so the problem is your code, fix your codde and all will be OK

 
Jefferson Metha:

Ok, so the problem is your code, fix your codde and all will be OK

Maybe.

Do you see any problems in how I have filled  MqlTradeRequest ?

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
  • www.mql5.com
Interaction between the client terminal and a trade server for executing the order placing operation is performed by using trade requests. The trade request is represented by the special predefined structure of MqlTradeRequest type, which contain all the fields necessary to perform trade deals. The request processing result is represented by...
Reason: