You need to use the time of the trading server. And it’s better to take it with a margin:
if(HistorySelect(0,TimeCurrent()+60*60*24;))
In general, the last deal needs to be caught in OnTradeTransaction.
![How to start with MQL5 How to start with MQL5](https://c.mql5.com/36/29/how-to-start-with-mql5__1.jpg)
How to start with MQL5
- 2019.08.18
- www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
Thank you so much Vladimir!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I need a function to retrieve the latest trades closed. I'm calling this function from OnTrade(). I use to program in MQL4 and I'm new to MQL5. Thanks for the help!