Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||
|
||||
## Source Files
|
||||
- `demo_filegetinteger.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
@@ -0,0 +1,69 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Demo_FileGetInteger.mq5 |
|
||||
//| Copyright 2013, MetaQuotes Software Corp. |
|
||||
//| http://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2013, MetaQuotes Software Corp."
|
||||
#property link "http://www.mql5.com"
|
||||
#property version "1.00"
|
||||
//--- 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
|
||||
ResetLastError();
|
||||
int handle=FileOpen(path,FILE_READ|FILE_CSV);
|
||||
if(handle!=INVALID_HANDLE)
|
||||
{
|
||||
//--- print all information about the file
|
||||
Print(InpFileName," file info:");
|
||||
FileInfo(handle,FILE_EXISTS,l,"bool");
|
||||
FileInfo(handle,FILE_CREATE_DATE,l,"date");
|
||||
FileInfo(handle,FILE_MODIFY_DATE,l,"date");
|
||||
FileInfo(handle,FILE_ACCESS_DATE,l,"date");
|
||||
FileInfo(handle,FILE_SIZE,l,"other");
|
||||
FileInfo(handle,FILE_POSITION,l,"other");
|
||||
FileInfo(handle,FILE_END,l,"bool");
|
||||
FileInfo(handle,FILE_IS_COMMON,l,"bool");
|
||||
FileInfo(handle,FILE_IS_TEXT,l,"bool");
|
||||
FileInfo(handle,FILE_IS_BINARY,l,"bool");
|
||||
FileInfo(handle,FILE_IS_CSV,l,"bool");
|
||||
FileInfo(handle,FILE_IS_ANSI,l,"bool");
|
||||
FileInfo(handle,FILE_IS_READABLE,l,"bool");
|
||||
FileInfo(handle,FILE_IS_WRITABLE,l,"bool");
|
||||
//--- close the file
|
||||
FileClose(handle);
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
//--- receive the property value
|
||||
ResetLastError();
|
||||
if((l=FileGetInteger(handle,id))!=-1)
|
||||
{
|
||||
//--- the value received, display it in the correct format
|
||||
if(!StringCompare(type,"bool"))
|
||||
Print(EnumToString(id)," = ",l ? "true" : "false");
|
||||
if(!StringCompare(type,"date"))
|
||||
Print(EnumToString(id)," = ",(datetime)l);
|
||||
if(!StringCompare(type,"other"))
|
||||
Print(EnumToString(id)," = ",l);
|
||||
}
|
||||
else
|
||||
Print("Error, Code = ",GetLastError());
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user