You need to select the history before dealing with it using HistoryDealGetIntege() or similar functions.

Documentation on MQL5: Trade Functions / HistoryDealSelect
- www.mql5.com
Selects a deal in the history for further calling it through appropriate functions. It returns true if the function has been successfully completed...
Alain Verleyen #:
You need to select the history before dealing with it using HistoryDealGetIntege() or similar functions.
Thank you for helping me.
I tried to use HistorySelect(), and it worked!
But HistoryOrderSelect(ulong ticket) didn't work.:(
Anyway, my code works well. Thank you for your information.:)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If you can help me resolve this situation, please let me know.
I was thinking about the process after StopLoss in OnTradeTransaction(). I wrote the following code.
When I backtested with this code, it did not work as expected. The reason was that HistoryDealGetInteger() only returned 0 no matter what property I specified.
So I used GeLastError() to check the error code and it returned ErrorCode4755. This is the error code for a missing transaction history.
However, in the MT5 log, there is a log where StopLoss is triggered and a deal ticket is issued, and the OnTraderTransaction() instruction is executed, so there should be transaction history.
1) Does HistoryDealGetInteger() not work during backtesting?
2) I would like to know if there is a solution to this problem.2) I would like to know if there is a solution to this problem.