Save OHLCV Data from Chart to CSV File – script MetaTrader 5

Save OHLCV Data from Chart to CSV File - script for MetaTrader 5
The standard method of getting historical data in metatrader5 is to use “View>Symbols>Request” tool as shown in the picture below: However, this sometimes doesn’t return all the data available on the chart. This script saves all the available historical data to a CSV file located in “Files” folder inside the “Common Data Path” directory. Note: Make … Read more

Quotes Monitoring (memory-mapped file) – EA MetaTrader 5

Quotes Monitoring  (memory-mapped file)
This Expert Advisor is example of use of the Memory Mapping DLL for working with File Mapping functions. In this example the Expert Advisor create a virtual (memory-mapped) file and start to update the quotes on symbol. Using this way, Expert Advisors can exchange data (for example, quotes) using common memory-mapped file. The format of … Read more

File Mapping without DLL – library MetaTrader 5

File Mapping without DLL - library for MetaTrader 5
The classes (conveted from C++ to MQL5) for working with memory mapped files. The C++ project was published in CodeBase: Memory Mapping. The example script is included. PS. Special thanks to  Renat and Nikolay for the idea. This example can be used for working with different WinAPI functions without writing of additional DLLs. File Mapping … Read more

CFastFile – class for working with uchar array as a virtual file – library MetaTrader 5

CFastFile - class for working with uchar array as a virtual file - library for MetaTrader 5
The CFastFile eliminates the need for an intermediate writing of data to the physical file on disk. It provides the significant acceleration when working with data. It has functions, similar to standard FileWriteXXX/FileReadXXX functions. It means that you can easily migrate from the use of the physical files to the fast work with the “virtual” … Read more

The example of the work with the CSV file as with a table – script MetaTrader 5

Output result of the script.
The script demonstrates the work with the table in which the only detail is necessity to know the number of columns. news.txt should be converted to csv file with delimiter”;”, or any other file but in the same code. filehandle=FileOpen(“News.csv”,FILE_READ|FILE_CSV|FILE_ANSI,’;’); Instead of “;” set this symbol. Such approach allows to work with each line separately, … Read more

Writing the quotes to a txt file with the full path and file name – library MetaTrader 4

Writing the quotes to a txt file with the full path and file name - library for MetaTrader 4
Function Description: #import “ITTPSymbol.dll”       int CreateFile(string Path, string symbol, int Priсe); An example of a function call: CreateFile(Path, Symbol(), Ask); As you can see, everything is very simple. The function will create a text file with the name ‘symbol’ and write(overwrite) the ‘Price’ value there. According to the path specified in the value of Patch. … Read more

HTML file converter for the economic calendar – script MetaTrader 5

HTML file converter for the economic calendar - script for MetaTrader 5
The script converts the news page downloaded from to a CSV text file. The source page should be located in C:\Users\<username>\AppData\Roaming\MetaQuotes\Terminal\Common\Files. The format syntactic parsing of the source file is implemented in this script. The resulting file can be used in MQL4/5 Expert Advisors and indicators. This is a universal script (you can change the … Read more