Flexible OHLC Spread and Volume Data Exporter
- 유틸리티
- Kenneth Weleh
- 버전: 2.20
- 활성화: 10
This script is an Intelligence Gathering Utility designed to give you full control over your data exports from MetaTrader 5. It allows you to synchronize up to three different symbols into a single file with precise timestamping.
1. Setting the Data Range (Range)
You can define exactly which historical period you want to capture:
-
Date Mode: If Last N bars (0 = use date range above) is set to 0, the script will export all data between your chosen start and end dates.
-
Bar Mode: By entering a number (e.g., 500) in Last N bars (0 = use date range above) , the script ignores the dates and simply takes the most recent 500 bars from the history.
2. Choosing Symbols (Multi-Symbol)
The script supports exporting up to three symbols simultaneously:
-
Symbol 1: If this field is left empty, the script automatically uses the symbol of the chart it is running on.
-
Symbols 2 & 3: You can add extra pairs here (e.g., "GBPUSD" and "USDJPY"). The script creates a "union timeline," meaning if one pair is missing a bar at a specific time, the cell is left empty to maintain perfect synchronization across all columns.
3. Customizing Columns (Columns)
Tailor your CSV file by toggling specific data points on or off:
-
OHLC: Open, High, Low, and Close prices.
-
Volume: Choose between Tick Volume (number of price changes) or Real Volume (actual traded volume, if supported by your broker).
-
Spread: Allows you to analyze liquidity and trading costs over time.
4. Time Zone and Formatting (Time)
To ensure the data fits your analysis tool (like Excel, Python, or R), you can select the time zone:
-
Server: The broker's time (default).
-
UTC: International standard time (GMT).
-
Local: Your own computer's time.
-
Seconds: You can choose whether the timestamp should be simple (HH:MM) or detailed (HH:MM:SS).
5. Export and Excel Optimization
The script includes several features to make post-processing easier:
-
Auto-Naming: The script can automatically name the file based on the symbols and timeframe (e.g., "EURUSD_GBPUSD_H1_OHLC_DATA.csv").
-
Excel Hint: By activating Write 'sep=;' first line so Excel auto-detects delimiter (locale-safe)? , a small code ( sep=; ) is inserted at the very top of the file. This forces Excel to open the file correctly in columns immediately, bypassing the manual import wizard.
-
Metadata: You can include an info block (at the top or bottom) that summarizes export details, such as the time zone used and the total number of rows.
When you run the script, the results and the specific file path will be displayed in your Experts Log in MetaTrader. You can find the file in the folder: MQL5/Files/ .
Settings:
=== Range ===
- Start Date (used when Last-N-Bars = 0): Set the beginning date for the data export if not using a specific bar count.
- End Date (used when Last-N-Bars = 0): Set the ending date for the data export if not using a specific bar count.
- Last N bars (0 = use date range above): Specify a total number of recent bars to export (set to 0 to use the date range instead).
=== File ===
- Auto-name file from Symbol(s) + Timeframe?: Toggle to automatically generate a file name based on the symbols and timeframe.
- File Name (used when Auto-name is OFF): Manually enter a custom file name to be used when auto-naming is disabled.
- Metadata block placement: Choose whether to place the file information block at the top, bottom, or hide it.
- Write 'sep=;' first line so Excel auto-detects delimiter (locale-safe)?: Toggle an invisible hint that helps Excel automatically recognize the file's data separator.
=== Time ===
- Time zone for the Date/Time columns: Select the time zone for the exported data (Server Time, UTC, or your Local PC time).
- Include seconds in Time column (HH:MM:SS)?: Choose whether to include seconds (HH:MM:SS) or just minutes (HH:MM) in the time column.
=== Columns ===
- Include Open column?: Choose whether to include the "Open" price column in the export.
- Include High column?: Choose whether to include the "High" price column in the export.
- Include Low column?: Choose whether to include the "Low" price column in the export.
- Include Close column?: Choose whether to include the "Close" price column in the export.
- Include TickVolume column?: Choose whether to include the "Tick Volume" column in the export.
- Include RealVolume column? (usually empty for retail forex): Choose whether to include the "Real Volume" column in the export.
- Include Spread column?: Choose whether to include the "Spread" column in the export.
=== Multi-Symbol ===
- Symbol 1 (empty = chart symbol): Primary symbol to export; leave blank to use the symbol of the current chart.
- Symbol 2 (empty = skip): Optional second symbol to export alongside the first for multi-symbol data.
- Symbol 3 (empty = skip): Optional third symbol to export alongside the others for multi-symbol data.
