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

2013.04.09 13:14

Demo_FileGetInteger - script for MetaTrader 5

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

votes: 26

The script opens a file located in the terminal local folder and displays values of its properties. The terminal local folder location can be obtained calling the TerminalInfoString() function.

PrintFormat("The path to the terminal local folder: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH)); 
This script demonstrates the example of using the first variant of the FileGetInteger() function, thus it displays values of its properties. For the second variant of the function only five first properties are available.


//--- display the window of input parameters when launching the script
#property script_show_inputs
//--- input parameters
input string InpFileName="data.csv";
input string InpDirectoryName="SomeFolder";
//| Script program start function                                    |
void OnStart()
   string path=InpDirectoryName+"//"+InpFileName;
   long   l=0;
//--- open the file
   int handle=FileOpen(path,FILE_READ|FILE_CSV);
      //--- print all information about the file
      Print(InpFileName," file info:");
      //--- close the file
      PrintFormat("%s file didn't open, ErrorCode = %d",InpFileName,GetLastError());
//| display the value of the file property                           |
void FileInfo(const int handle,const ENUM_FILE_PROPERTY_INTEGER id,
              long l,const string type)
//--- get the property value
      //--- the value received, display it in the correct format
         Print(EnumToString(id)," = ",l ? "true" : "false");
         Print(EnumToString(id)," = ",(datetime)l);
         Print(EnumToString(id)," = ",l);
      Print("Error, Code = ",GetLastError());

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.

Holt's double exponential smoothing trend Holt's double exponential smoothing trend

Holt's double exponential smoothing - the trend component (mt4 version).

Holt's double exponential smoothing (mt4 version) Holt's double exponential smoothing (mt4 version)

Holt's double exponential smoothing with linear forecasting.