How can I read the history file using kernell32 library in mql4 and mql5?

To add comments, please log in or register
rod777
110
rod777  

How can I read the history file using kernell32 library in mql4 and mql5?

Fernando Carreiro
4737
Fernando Carreiro  
rod777: How can I read the history file using kernell32 library in mql4 and mql5?

In MetaTrader v5 history files are encrypted so you can't read them form external source, but obviously in MQL5 you can read the data directly so there is no need o use the Kernal32 library.

In MetaTrader v4 history files are not encrypted, but also you can read the data directly as well without the need for the Kernal32 library.

rod777
110
rod777  
I want to do something like this in mq5
Files:
Fernando Carreiro
4737
Fernando Carreiro  
rod777: I want to do something like this in mq5

As I have stated, in MetaTrader v5, you can't read the History file directly because it is encrypted, but you can just read the data directly by using the CopyRates() function. You can even read tick data directly as well with the CopyTicksRange() function.

Even on MetaTrader v4, there is no need to read the history directly, unless you are trying to circumvent the Strategy Tester to look ahead and thus produce false trading results, which is unethical.

rod777
110
rod777  
thanks, can you give an example code?
Fernando Carreiro
4737
Fernando Carreiro  
rod777: thanks, can you give an example code?

I have given you the link to the documentation which includes example code.

There are also examples in the CodeBase: https://www.mql5.com/en/search#!keyword=CopyRates&module=mql5_module_codebase

Learn to use the Search function!

Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
rod777
110
rod777  
thanyou
To add comments, please log in or register