Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2008.08.12 08:53

File Operations without Limitations - script for MetaTrader 4

| English Русский 中文 Español Deutsch 日本語 Português

votes: 5

In the "Tools" window of MetaEditor, it is written for the FileOpen function:

Metatraders file functions are limited to the terminals sandbox and its specific folders for files.

And there is no shared-access mode for an open file. At least, it is not given explicitly.

But I would prefer to save files where I want and to read them from where I want. And also to pass data from one operating EA into another operating EA through a file.

I asked on the forum to search in system libraries for how to use file operations in an EA, but nobody seemed being able to do that, although we discussed the SendMessage function from Shell32.dll. Delphi-biased, though.

Well, the functions of file operations are used in the system library of kernel32.dll. It is this library that we import into the EA. The code is attached. Create a file as follows: "C:\Text.txt", save some text in it. Launch the attached script. The script reads the entire contents of the file. Add some checks for delimiter characters and for line end characters, some cherry syrup - and the ReadLine function is ready...

Note. In the MetaEditor Dictionary, we read: "The length of a string constant ranges from 0 to 255 characters. If the length of a string constant exceed the maximal allowed one, the excessive characters from the right will be cut off, while the compiler shows the following warning:...".

Translated from Russian by MetaQuotes Software Corp.
Original code:

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

Yen Trader Yen Trader

Expert Advisor to trade Yen Crosses based on Major Pairs and USDJPY divergence/convergence.

Example of MACD Automated Example of MACD Automated

Code example of MACD automated with advanced money management function.