Write quotes to txt file with full path and file name - MetaTrader 4 Library - MT4/MT5 Resources
Function description:
#import "ITTPSymbol.dll" integer create file( string path, string symbol, integer price);
Example of function call:
createFile(path, symbol (), q );
As you can see, everything is very simple. This function will create a text file named "symbol" and write (overwrite) the "Price" value in it. The path specified based on the value of Patch. The library is written in Delphi. Can be redone if anyone is interested.
Source code for this library in Delphi:
Library ITP symbols ; usage classes , dialog boxes , system utilities ; { $ r *. resource } function createfile ( path : puchar ; symbol : puchar ; price : integer ) : integer ; standard call ; variables output file : text file ; begin allocateFile ( outputFile , string ( path ) + '\' + string ( symbol ) + ' .txt ' ) ; try overwrite ( outputfile ) ; write ( outputfile , price ) ; close file ( outputfile ) ; result := 0 ; except result := 1 ; end ; result := 0 ; end ; export creates file ; end .
The CreateFile() function returns 0 if the function runs successfully, otherwise it returns -1.
The sample script writes the current symbol name under which the script is run to the C:\ drive. At the same time, the "Price" parameter of type "integer" is written to the file:
//+------------------------------------------------------------------+ //| ITTPSymbol.mq4 | //| Copyright © 2007 ITTP Gr. | //| http://www.ITTPortal.net | //+------------------------------------------------------------------+ #Property Copyright "Copyright © 2007 ITTP Gr." #Property associated with "http://www.ITTPortal.net" //---- #import "ITTPSymbol.dll" integer create file( string trail, string symbol, integer price); string trail; //+------------------------------------------------------------------+ //|Script program startup function | //+------------------------------------------------------------------+ integer start() { Path = "C:" ; // The last slash "\" was not specified! createFile(path, symbol (), 53 ); //---- return ( 0 ); } //+------
That's it, use it however you want.
April 16, 2007. Fixed several bugs in new version dll:
Older versions of the library are removed so they can be downloaded safely.
Attachment download
📎ITTPSymbol.dll (384 KB)
Source: MQL5 #7084
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •