DinexSpace CSV Table Library
- 라이브러리
- 버전: 1.0
DinexSpace CSV Table Library is a library for MetaTrader 5 (MT5) that builds tables with named columns and writes and reads them as CSV files, for your indicator or Expert Advisor. You add rows, set each cell as text, a number, a whole number or a time, save the file, and load it back later. Text with commas, quotes and line breaks is handled for you.
How it works
- Call DxCsvCreate to get a table, then DxCsvSetColumns with the column names, for example "time,symbol,profit".
- Call DxCsvAddRow for each new row, then DxCsvSetText, DxCsvSetNumber, DxCsvSetInteger or DxCsvSetTime for the cells.
- Call DxCsvSave to write the file, or DxCsvLoad to read one. Read the cells with DxCsvGetText, DxCsvGetNumber, DxCsvGetInteger or DxCsvGetTime.
What you get
- Tables with named columns: up to 256 columns and one million rows.
- Typed cells: text, a number with 0 to 16 digits, a whole number, a time.
- Awkward text: commas, quotes, line breaks, accented letters and symbols are saved and loaded back unchanged. Files are UTF-8; both CR LF and LF line endings are read.
- Add to a file: add rows at the end of an existing file; the first line must have the same column names, otherwise nothing is written.
- Terminal or common Files folder: your choice in each call.
- Status codes with plain-English texts: bad file name, ragged file, wrong column, cell that is not a number.
- Light: each program has its own tables. No DLLs, no web requests, no Sleep.
How to use it
- Copy DinexCsvTable.ex5 to MQL5\Libraries.
- Add the import block with the functions you use (shown in the images and in the example EA).
- Create a table, set the columns, add rows, save or load.
Example EA (included in the description images)
The example adds one row of prices to a table on every new bar. At the start and at the end it saves tables and compares each file byte by byte with a separate writer, loads the files back and compares every cell, loads hand-written files with known answers, and tries the error cases. It prints the number of checks and the number of failed checks.
Notes
- A cell with a comma, a quote or a line break is written between quotes, and a quote inside it is doubled. An empty cell of a one-column table is written as "".
- Empty lines in a file are skipped. A line with another number of fields than the first line stops the load with an error.
- The whole file is read into memory when you load it. Files are UTF-8 with commas between the fields.
- The library gives no entries or exits and does not predict any move.
Requirements
- MetaTrader 5, any symbol and timeframe.
