How does HistoryDealGetInteger() in backtest?
You need to select the history before dealing with it using HistoryDealGetIntege() or similar functions.
- www.mql5.com
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.:)
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.