
mql5-indicator-patterns
MQL5 indicator development patterns. TRIGGERS - MQL5 indicator, OnCalculate, indicator buffers, MetaTrader 5.
- Installs
- 501
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/terrylica/cc-skills --skill mql5-indicator-patterns- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads mql5-indicator-patterns automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
MQL5 Visual Indicator Patterns
Battle-tested patterns for creating custom MQL5 indicators with proper display, buffer management, and real-time updates.
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.
When to Use This Skill
Use this skill when:
- Creating custom MQL5 indicators for MetaTrader 5
- Debugging indicator display or buffer issues
- Setting up OnCalculate with proper warmup handling
- Implementing new bar detection patterns
Quick Reference
Essential Patterns
Display Scale (for small values < 1.0):
IndicatorSetDouble(INDICATOR_MINIMUM, 0.0);
IndicatorSetDouble(INDICATOR_MAXIMUM, 0.1);
Buffer Setup (visible + hidden):
SetIndexBuffer(0, BufVisible, INDICATOR_DATA); // Visible
SetIndexBuffer(1, BufHidden, INDICATOR_CALCULATIONS); // Hidden
New Bar Detection (prevents drift):
static int last_processed_bar = -1;
bool is_new_bar = (i > last_processed_bar);
Warmup Calculation:
int StartCalcPosition = underlying_warmup + own_warmup;
PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, StartCalcPosition);
Common Pitfalls
Blank Display: Set explicit scale (see Display Scale reference)
Rolling Window Drift: Use new bar detection with hidden buffer (see Recalculation reference)
Misaligned Plots: Calculate correct PLOT_DRAW_BEGIN (see Complete Template reference)
Forward-Indexed Arrays: Always set ArraySetAsSeries(buffer, false)
Key Patterns
For production MQL5 indicators:
- Explicit scale for small values (< 1.0 range)
- Hidden buffers for recalculation tracking
- New bar detection prevents rolling window drift
- Static variables maintain state efficiently
- Proper warmup calculation prevents misalignment
- Forward indexing for code clarity
These patterns solve the most common indicator development issues encountered in real-world MT5 development.
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Blank indicator window | Scale not set for small values | Set INDICATOR_MINIMUM/MAXIMUM explicitly |
| Values drifting over time | Rolling window not reset | Use new bar detection with hidden buffer |
| Misaligned plot start | Wrong PLOT_DRAW_BEGIN | Calculate: underlying_warmup + own_warmup |
| Reversed array indexing | Series mode enabled | Call ArraySetAsSeries(buffer, false) |
| Buffer values incorrect | Wrong INDICATOR_DATA type | Use INDICATOR_CALCULATIONS for hidden buffers |
| Compile error on buffer | Buffer count mismatch | Match #property indicator_buffers with SetIndexBuffer |
| Indicator not updating | OnCalculate return wrong | Return rates_total to signal successful calculation |
| Performance issues | Recalculating all bars | Only recalculate from prev_calculated onwards |
Reference Documentation
For detailed information, see:
- Display Scale - Fix blank indicator windows for small values
- Buffer Patterns - Visible and hidden buffer architecture
- Recalculation - Bar detection and rolling window state management
- Complete Template - Full working example with all patterns
- Debugging - Checklist for troubleshooting display issues
Post-Execution Reflection
After this skill completes, check before closing:
- Did the command succeed? — If not, fix the instruction or error table that caused the failure.
- Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
- 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.
FAQ
What does the mql5-indicator-patterns skill do?
MQL5 indicator development patterns. TRIGGERS - MQL5 indicator, OnCalculate, indicator buffers, MetaTrader 5.
How do I install mql5-indicator-patterns?
Run npx skills add https://github.com/terrylica/cc-skills --skill mql5-indicator-patterns in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/mql5-indicator-patterns/ (personal) or .claude/skills/mql5-indicator-patterns/ (project).
Which AI agents can use mql5-indicator-patterns?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is mql5-indicator-patterns safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains mql5-indicator-patterns?
It is published by terrylica in terrylica/cc-skills. It has 501 recorded installs.
More from terrylica/cc-skills
mise-tasks
terrylica/cc-skills
Orchestrate multi-step project workflows using mise task definitions with dependency management and argument handling. Use whenever the user.
pandoc-pdf-generation
terrylica/cc-skills
PDF generation from markdown via Pandoc/XeLaTeX. TRIGGERS - markdown for PDF, print document, pandoc
python-logging-best-practices
terrylica/cc-skills
Python logging with loguru, structlog, and orjson. TRIGGERS - loguru, structlog, structured logging
gdrive-access
terrylica/cc-skills
Access Google Drive via CLI with 1Password OAuth: list files, download, and sync folders. TRIGGERS - google drive, gdrive, drive folder, download drive, sync drive.
chezmoi-workflows
terrylica/cc-skills
Dotfile backup and sync with chezmoi. TRIGGERS - chezmoi, dotfiles, sync dotfiles, backup configs, cross-machine sync.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.