How to know when reaching the end of file?

 

In MT4, there is a error code "ERR_END_OF_FILE". When using GetLastError(), user can know when  reaching the end of file.

But in MT5, there is no such a error code, how to do the same work in MT5, just like in MT4?

Thanks 

 
Reason: