Operate and troubleshoot the MT5 tick collection system on Linux/Wine. Systemd topology, gap detection, restart recovery, daily rotation. TRIGGERS - tick collection, MT5 Wine, tick gaps, EA restart, systemd MT5, tick writer DLL.
From mql5npx claudepluginhub terrylica/cc-skills --plugin mql5This skill is limited to using the following tools:
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Operate, monitor, and troubleshoot the zero-gap tick collection system running on Linux via Wine.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
Use this skill when:
TickCollector EA (MQL5) --> tick_writer.dll (Rust) --> Parquet files
OnTick() callback C-ABI FFI ZSTD compressed
CopyTicksRange() Buffered writes One file per day
Watermark dedup Row group flush
| Resource | Path |
|---|---|
| Git repo | ~/eon/mql5/ |
| Wine prefix | ~/.mt5/ |
| MT5 install | ~/.mt5/drive_c/Program Files/MetaTrader 5/ |
| EA source | {repo}/mql5_ea/TickCollector.mq5 |
| DLL (Windows) | {mt5}/MQL5/Libraries/tick_writer.dll |
| Tick data | {mt5}/tick_data/ (symlinked to ODB cache) |
| Systemd units | systemd user units: xvfb, xfce, x11vnc, mt5 |
xvfb (virtual framebuffer)
--> xfce (desktop environment)
--> x11vnc (VNC access)
--> mt5 (MetaTrader 5 via Wine)
All are user-level systemd units. MT5 depends on the display stack. The chain must start in order -- xvfb first, mt5 last.
{SYMBOL}_{YYYYMMDD}.parquettw_close (finalize current file) + tw_init (open new file)On EA restart:
tw_get_last_time_msc to read resume watermark from the last Parquet file footer_1, _2 suffix (not overwrite)CopyTicksRange from the watermarkThe Rust DLL renames corrupt/incomplete files to _partial suffix rather than attempting recovery.
Use DuckDB to check for gaps between consecutive ticks:
WITH ticks AS (
SELECT time_msc,
lead(time_msc) OVER (ORDER BY time_msc) - time_msc AS gap_ms
FROM read_parquet('{base_path}/FXVIEW_{SYMBOL}/{YYYY}/{SYMBOL}_{YYYYMMDD}.parquet')
)
SELECT time_msc, gap_ms,
make_timestamp(time_msc * 1000) AS ts
FROM ticks
WHERE gap_ms > 60000 -- gaps > 1 minute
ORDER BY gap_ms DESC;
Interpreting results:
These are CRITICAL anti-patterns -- violations cause silent crashes or data loss:
%I64u or %I64d format specifiers in MQL5 -- crashes Wine silently. Use IntegerToString() instead.iconv -f UTF-16LE -t UTF-8 to read itDISPLAY=:99 must be set (Xvfb virtual display number)Use /mql5:mql5-ship slash command for full deployment:
--ea-only for EA source changes--dll-only for Rust DLL changesDetailed deployment steps (SSH commands, file copies, compilation) are in the headless-mt5-remote local skill. Not duplicated here to avoid drift.
systemctl --user status mt5
ls -la ~/.cache/opendeviationbar/ticks/FXVIEW_EURUSD/$(date +%Y)/
duckdb -c "SELECT count(*) FROM read_parquet('path/to/file.parquet')"
ls ~/.cache/opendeviationbar/ticks/FXVIEW_EURUSD/$(date +%Y)/*_[0-9].parquet 2>/dev/null
systemctl --user list-units --type=service | grep -E "xvfb|xfce|x11vnc|mt5"
journalctl --user -u mt5 --since "1 hour ago" --no-pager
headless-mt5-remote local skill: Deployment steps (SSH, file copy, compilation)fxview-parquet-consumer skill: Data consumption patterns (schema, DuckDB queries)| Issue | Cause | Solution |
|---|---|---|
| MT5 service won't start | Display stack not running | Start xvfb first, then xfce, x11vnc, mt5 |
| EA not collecting ticks | Symbol not in Market Watch | Open chart for symbol in MT5, re-attach EA |
| Wine crash on PrintFormat | Using %I64u/%I64d specifiers | Replace with IntegerToString() |
| DLL load failure | Missing tick_writer.dll | Copy DLL to MQL5/Libraries/ (physical copy) |
| Gaps in tick data | EA restart or network issue | Check journalctl, verify recovery segments exist |
| Recovery file _1_2 | Normal after restart | All segments are valid, union in DuckDB |
| Compile log unreadable | UTF-16LE encoding | Use iconv -f UTF-16LE -t UTF-8 |
| Xvfb not running | Service crashed or not enabled | systemctl --user start xvfb |
After this skill completes, check before closing:
Only update if the issue is real and reproducible — not speculative.