당사 팬 페이지에 가입하십시오
CFastFile - class for working with uchar array as a virtual file - MetaTrader 5용 라이브러리
- 조회수:
- 4704
- 평가:
- 게시됨:
- 2012.03.02 09:09
- 업데이트됨:
- 2017.05.02 10:01
- 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
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" files in memory. The data storage and reading/writing is based on use of the uchar-array instead of the physical file.
List of functions:
CFastFile(uchar &data[]); // constructor with initialization of file data from array void Clear(); // clear file //--- functions for working with file properties void Delim(uchar delim=';'); // set delimiter (data separator) for CSV mode int Size(); // gets file size int Tell(); // gets current position void Seek(int offset, int origin); // seek bool IsEnding(); // checking of end of file (EOF) bool IsLineEnding(); // checking of end of line //--- functions for writing the data to file uint WriteArray(uchar &src[], uint src_start=0, int src_cnt=WHOLE_ARRAY); // write uchar array uint WriteDouble(double v); // write double uint WriteFloat(float v); uint WriteLong(long v); uint WriteInt(int v); uint WriteShort(short v); uint WriteChar(char v); uint WriteInteger(int v, int sz=INT_VALUE); // write integer - for compatibility with standard FileWriteInteger uint WriteString(string v, int cnt); // write string cnt=-1 means CSV mode with addition of \r\n //--- functions for reading from file uint ReadArray(uchar &dst[], uint dst_start=0, int cnt=WHOLE_ARRAY); // read array double ReadDouble(); // read double float ReadFloat(); long ReadLong(); int ReadInt(); short ReadShort(); char ReadChar(); int ReadInteger(int sz=INT_VALUE); // read integer - for compatibility with standard FileReadInteger double ReadNumber(); // string ReadString(int cnt); read string. cnt=-1 means CSV mode - reading to delimiter (data separator) //--- functions, used to save data uint Save(uchar &v[]); // save file to uchar array uint Save(int h); // save file to the real file on disk. h - file handle (the file must be opened) uint Save(string file); // save file to the real file on disk. file - file name //--- functions, used for loading of data uint Load(uchar &v[]); // load file from uchar array uint Load(int h); // load data from real file on disk. h - file handle (the file must be opened) uint Load(string file); // load data from real file on disk. file - file name
One can see, the functions are named similar to the standard file operations.
The migration from real files to the CFastFile is very easy. Instead of file open and getting file handle (for example, int h) you need to create the CFastFile class instance, for example:
CFastFile f;
The next you need to change the conventional file functions according to the rule:
FileWriteDouble(h, 10) -> f.WriteDouble(10)
For convenience, the Save/Load functions is added - it allows you to save/load the "virtual" file data to the real file on disk.
The demo example of CFastFile class use in included.
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/845
Trading signals module for MQL5 Wizard. WPRSIsignal indicator's color arrow serves as a market entry signal.
Trading signals module based on Candles_Smoothed indicatorTrading signals module for MQL5 Wizard. The moment, when a candlestick formed by Candles_Smoothed changes its color, indicates the time for market entry.
Trading signals module for MQL5 Wizard. The moment, when ColorJFatl indicator changes its color, indicates the time for market entry.
Trading signals module based on SilverTrend_Signal indicatorTrading signals module for MQL5 Wizard. SilverTrend_Signal indicator's color dot serves as a market entry signal.