Universal Delimiter Converter
Every export tool in this catalogue picks one delimiter at FileOpen time and cannot be told to emit a different one afterwards. This script covers the case that only shows up after the file already exists: a spreadsheet or a colleague's locale expects semicolons, but the export was written with commas, or the reverse. The naive version of this - a straight find-and-replace of the delimiter character - breaks the moment any field's own text contains that character, since a replaced delimiter inside a quoted value silently splits it into extra columns. This script parses each line field by field first, honouring double-quoted fields and the doubled-quote ("") escape for a literal quote inside one, and only then re-joins the fields with the new delimiter, quoting a field again if (and only if) it now contains the target delimiter or a quote character. The file is processed one line at a time, which means a field containing a literal line break inside its quotes - a genuinely multi-line CSV record - is not supported. Such a line is detected (its quote never closes before the line ends) and is written through to the output unchanged rather than silently mangled, and its line number is reported in the summary so it can be fixed by hand. Notes and limitations - A quoted field containing a literal line break is not supported; such a line is written through unchanged and flagged in the summary rather than corrupted. - The converter assumes the source file already uses valid quoting for its stated delimiter. A file that mixes delimiters inconsistently, or that uses quotes in a non-standard way, may not split as expected. - This tool does not validate row/column consistency (e.g. a ragged file with a different field count per line) - it converts whatever fields it finds on each line, one line at a time. - Output is written with FILE_TXT, not FILE_CSV, so the exact target delimiter and quoting rules above are always what actually lands on disk, rather than whatever MQL4's own CSV writer would choose.
Script · MT5 · v1.0 · Free
About Universal Delimiter Converter
Universal Delimiter Converter is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Source file, Source delimiter and Target delimiter. MQL source code included.
Files in the download: UniversalDelimiterConverter.ex5, UniversalDelimiterConverter.mq5, UniversalDelimiterConverter.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Source file | Source filename in MQL5\Files | |
| Source delimiter | DelimComma | Delimiter used by the source file |
| Target delimiter | DelimSemicolon | Delimiter to write into the output file |
| Output file | Output filename in MQL5\Files (blank = auto) | |
| Always quote fields | false | Quote every field, not just ones that need it |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code