Smart Data Export Indicator MT4
- Utilities
-
Mikoto Hamazono
AI Trader Kyo | MQL Developer & Forex Innovator
As an MQL developer and a passionate innovator in FX, I build cutting-edge trading solutions that make full use of artificial intelligence. - Version: 1.0
Smart Data Export Indicator MT4 writes clean market data from MetaTrader 4 to CSV or JSON Lines - with exactly the columns you choose and a data card that explains every column, ready for Python, Excel or an AI assistant such as ChatGPT or Claude.
It replaces my free SmartDataExportEa for MetaTrader 4 and is rebuilt as an indicator: it runs on the same chart as your Expert Advisor, and it never trades. No DLL, no web requests. A MetaTrader 5 version is available separately.
What it writes
- Data file (CSV with comma or semicolon, or JSON Lines): one row per closed bar, oldest first, UTF-8. New bars are appended as they close; the file is never rewritten, so Python, Excel or Power BI can read it while it grows. If another program locks the file, the rows wait and are written later.
- Data card (.md): symbol specification, server time zone, a dictionary of every column with its unit and warm-up rows, warnings, a quality report (weekend and daily breaks, real gaps, duplicate times, range spikes) and a prompt to paste into an AI chat together with the file.
- Closed orders (optional): the orders shown in the terminal's Account History, with magic number, commission, swap and stop loss.
Columns you can choose
- Price (open, high, low, close) and tick volume. Spread is filled for rows appended live, because MetaTrader 4 does not store a spread for each bar.
- Bar shape: return, range, body, wicks and gap (in points), and log return.
- Time features: UTC time (the broker's offset is detected for every week), ISO weekday, hour and session label (Tokyo, London, New York, daylight-saving aware).
- Indicators by name in one input: RSI(14); EMA(50); ATR(14); MACD(12,26,9); BB(20,2); STOCH(14,3,3); ADX(14) - also SMA, SMMA, LWMA, CCI, MFI, WPR, MOM, STDDEV, OBV, AO, SAR and ICHIMOKU.
- Any custom indicator buffer: MyIndicator:0,1. A name that cannot be loaded is reported and skipped.
- Higher-timeframe context (H1, H4, D1 and others): open, high, low and close of the last bar that had already closed.
Safe for analysis
- Only closed bars are written; the bar still forming never is.
- Higher-timeframe values come from bars that had closed by the close of each row (no look-ahead). Ichimoku's Chikou line is not offered because it uses later bars.
- Warm-up rows (bars without enough history for an indicator) are left empty and listed in the data card.
Things to know
- Files are written to MQL4\Files\SmartDataExport, or to Terminal\Common\Files with the "common folder" option.
- History depth depends on what your broker provides and on "Max bars in history" and "Max bars in chart" (Tools - Options - Charts).
- Higher timeframes and H1 (used to detect the server time zone) are downloaded from the broker the first time. The indicator waits a few seconds for them; if they do not arrive, those columns stay empty and the data card says so.
- In the Strategy Tester the files are written to the tester\files folder.
Inputs
- Timeframe, range (last N bars, a date range or all history), what to do after the history (keep appending or stop).
- Columns: price, tick volume, spread, bar shape, time features; indicators; custom indicators; higher timeframes.
- File name ({symbol}, {tf}, {date}), format (CSV, CSV with semicolon, JSON Lines), time format (ISO 8601, Unix, MetaTrader), common folder, data card, UTF-8 BOM for Excel, price decimals.
- Closed orders (off), server GMT offset (-99 = automatic), panel.
Support
If anything is unclear, please send me a private message on MQL5.
