Skip to main content
skill CX Codex

log-reader — Claude Code skill: what it does, how to install

log-reader reads MetaTrader 5 log files and Print() output straight from UTF-16LE daily logs without checking the Experts tab manually.

MIT 145 installs ★ 3 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add terrylica/cc-skills --skill log-reader -a claude-code
Open on GitHub

What log-reader does

This skill locates daily terminal logs under $MQL5_ROOT/Program Files/MetaTrader 5/MQL5/Logs/YYYYMMDD.log to inspect messages from custom indicators, scripts, and expert advisors. It relies exclusively on Read, Bash, and Grep tools. The Read tool handles native UTF-16LE log encoding on its own, so debug statements are immediately readable.

Included workflows target common validation routines: matching test pass or fail lines, diagnosing OnInit initialization failures, and hunting compilation warnings. The tool covers the text log side of MT5 dual-logging architectures, complementing structured CSV audit files.

Without the MQL5_ROOT environment variable configured, path resolution fails immediately. File paths also require strict quoting due to standard directory spaces on disk.

What it helps with

  • inspect MT5 indicator compilation and runtime errors
  • verify expert advisor and script unit test results
  • extract Print() debug messages without opening Experts tab
  • tail recent log entries generated during the current day

Example prompts for the agent

  • Check today's MT5 logs for indicator runtime errors
  • Search MT5 logs to see if PatternDetector unit tests passed
  • Show the last 50 lines from today's MetaTrader 5 log file

How to install log-reader

1Skills CLI (Vercel)

npx skills add terrylica/cc-skills --skill log-reader -a claude-code

2Manually: put the files in place

~/.claude/skills/log-reader/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/log-reader/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about log-reader

How to install log-reader in Claude Code?

Run npx skills add terrylica/cc-skills --skill log-reader -a claude-code. The skill specification will be placed in ~/.claude/skills/log-reader/SKILL.md.

What does log-reader do?

It calculates the daily log path based on the current date, reads the UTF-16LE log file, and runs targeted regex searches for test outcomes or runtime errors.

What environment setup is required?

Set the MQL5_ROOT environment variable so the agent can find the terminal directory. MetaTrader 5 must also be running to generate the active day's log.

Source text

SKILL.md · MIT
---
name: log-reader
description: Read MetaTrader 5 log files. TRIGGERS - MT5 logs, Experts pane, indicator errors, compilation errors.
allowed-tools: Read, Bash, Grep
---

# MT5 Log Reader

Read MetaTrader 5 log files directly to access Print() output from indicators, scripts, and expert advisors without requiring manual Experts pane inspection.

> **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.

## Purpose

Implement "Option 3" dual logging pattern:

- **Print()** - MT5 log files (human-readable via Experts pane)
- **CSV files** - Structured data (programmatic analysis)

Claude Code can autonomously read both outputs without user intervention.

## When to Use This Skill

Use this skill when:

- Validating MT5 indicator/script execution
- Checking compilation or runtime errors
- Analyzing Print() debug output
- Verifying unit test results (Test_PatternDetector, Test_ArrowManager)
- User mentions checking "Experts pane" manually

## Log File Location

MT5 logs are stored at:

```
$MQL5_ROOT/Program Files/MetaTrader 5/MQL5/Logs/YYYYMMDD.log
```

**File Format**:

- Encoding: UTF-16LE (Little Endian)
- Structure: Tab-separated fields (timestamp, source, message)
- Size: Grows throughout day (typically 10-100KB)

## Instructions

### 1. Construct today's log path

```bash
/usr/bin/env bash << 'SKILL_SCRIPT_EOF'
# Determine current date
TODAY=$(date +"%Y%m%d")

# Build absolute path
LOG_FILE="$MQL5_ROOT/Program Files/MetaTrader 5/MQL5/Logs/${TODAY}.log"
SKILL_SCRIPT_EOF
```

### 2. Read the entire log file

Use Read tool:

- File path: Absolute path from step 1
- The file contains all Print() statements from MT5 indicators/scripts
- UTF-16LE encoding is automatically handled by Read tool

### 3. Search for specific content (optional)

Use Grep to filter entries:

```
Pattern: indicator name, "error", "test.*passed", etc.
Path: Log file path from step 1
Output mode: "content" with -n (line numbers)
Context: -A 5 for 5 lines after matches
```

### 4. Analyze recent entries (optional)

Use Bash with tail for latest output:

```bash
tail -n 50 "$LOG_FILE"
```

## Common Validation Patterns

### Check unit test results

Search for test pass/fail indicators:

```
Pattern: test.*passed|test.*failed|Tests Passed|Tests Failed|ALL TESTS PASSED
Output mode: content
Context: -B 2 -A 2
```

### Find compilation errors

```
Pattern: error|ERROR|warning|WARNING|failed to create
Output mode: content
Context: -A 3
```

### Monitor specific indicator

```
Pattern: CCI Rising Test|PatternDetector|ArrowManager
Output mode: content
Context: -A 2
```

### View initialization messages

```
Pattern: OnInit|initialization|Initialization complete|Phase \d+
Output mode: content
```

## Examples

### Example 1: Validate unit test completion

```
Input: User compiled Test_PatternDetector.mq5
Action:
  1. Read today's log file
  2. Grep for "Test.*PatternDetector|Tests Passed|Tests Failed"
  3. Report results (e.g., "17 tests passed, 0 failed")
Output: Test status without user checking Experts pane
```

### Example 2: Check for runtime errors

```
Input: User reports indicator not working
Action:
  1. Read today's log file
  2. Grep for "ERROR|error|failed" with -A 3 context
  3. Analyze error messages
Output: Specific error details and line numbers
```

### Example 3: Verify Phase 2 arrow creation

```
Input: User asks "did the test arrow get created?"
Action:
  1. Read today's log file
  2. Grep for "Phase 2|Test arrow created|Failed to create"
  3. Check for success/failure messages
Output: Arrow creation status with timestamp
```

## Security Considerations

- Log files may contain sensitive trading data (symbol names, account info)
- Restricted to Read, Bash, Grep tools only (no network access via WebFetch)
- Do not expose absolute paths unnecessarily in user-facing output
- Filter sensitive information when reporting results
- No file modification operations allowed

## Integration with Dual Logging

This skill enables programmatic access to one half of the dual logging pattern:

1. **MT5 Log Files** (this skill) - Human-readable Print() output
2. **CSV Files** (CSVLogger.mqh) - Structured audit trails for validation

Both are accessible without user intervention:

- MT5 logs: Read via this skill
- CSV files: Read directly via Read tool or validate_export.py

## Validation Checklist

When using this skill:

- [ ] Log file exists for today's date
- [ ] File size > 0 (not empty)
- [ ] Contains expected indicator/script output
- [ ] Timestamps match execution time
- [ ] Error messages (if any) are actionable
- [ ] Test results (if applicable) show pass/fail counts

## References

- MT5 file locations: `docs/guides/MT5_FILE_LOCATIONS.md`
- Dual logging implementation: `docs/plans/cci-rising-pattern-marker.yaml` Phase 3-4
- CSVLogger library: `Program Files/MetaTrader 5/MQL5/Indicators/Custom/Development/CCINeutrality/lib/CSVLogger.mqh`

---

## Troubleshooting

| Issue                  | Cause                        | Solution                                          |
| ---------------------- | ---------------------------- | ------------------------------------------------- |
| Log file not found     | Wrong date or path           | Verify YYYYMMDD.log format and MQL5_ROOT env var  |
| Empty log file         | MT5 not running or no output | Ensure MT5 is running and Print() is being called |
| Encoding errors        | UTF-16LE not handled         | Read tool handles encoding automatically          |
| Missing test results   | Test not executed            | Compile and run test script in MT5 first          |
| Grep finds nothing     | Wrong pattern                | Use case-insensitive (-i) or broader pattern      |
| Old log data           | Log rotation                 | Each day creates new YYYYMMDD.log file            |
| Path contains spaces   | Unquoted path variable       | Quote paths: "$LOG_FILE"                          |
| Sensitive data exposed | Trading info in logs         | Filter sensitive fields when reporting to user    |


## Post-Execution Reflection

After this skill completes, check before closing:

1. **Did the command succeed?** — If not, fix the instruction or error table that caused the failure.
2. **Did parameters or output change?** — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
3. **Was a workaround needed?** — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

© terrylica · MIT · terrylica/cc-skills

Similar skills

All skills for Testing and QA →

From the same set79

The whole set →
dead-code-detector dead-code-detector finds unreachable code, unused imports, and dead exports across Python, TypeScript, and Rust codebases. Useful before major releases and refactoring sprints. CX Codex +1 150installs plotext-financial-chart plotext-financial-chart builds pure text financial line charts for Markdown files using plotext. It helps display price paths directly in GitHub documentation without external images. CX Codex +1 146installs latex-setup The latex-setup skill sets up and verifies LaTeX on macOS, then configures Skim and SyncTeX. It supports Mac preparation and TeX package troubleshooting. CX Codex +1 146installs adaptive-wfo-epoch adaptive-wfo-epoch sets how many epochs to train on each walk-forward fold, ranking candidates by walk-forward efficiency rather than one fixed number for the whole run. CX Codex +1 146installs adr-code-traceability The adr-code-traceability skill links code to Architecture Decision Records with file headers or inline comments. Use it when an implementation choice needs a clear connection to its decision record. CX Codex +1 144installs mlflow-python mlflow-python is a Claude Code skill for logging backtest parameters and metrics in MLflow, searching experiment runs, and retrieving metric history via the Python API. CX Codex +1 139installs code-clone-assistant code-clone-assistant detects duplicate code using PMD CPD and Semgrep, guides refactoring of DRY violations. Catches both exact clones and similar patterns. CX Codex +1 139installs article-extractor article-extractor downloads technical articles and documentation from mql5.com for reference or training datasets. Useful for collecting MQL5 code examples by URL or author. CX Codex +1 138installs

Project sponsors

Companies that keep this analytics open