スキル一覧に戻る
terrylica

mql5-indicator-patterns

by terrylica

Claude Code Skills Marketplace: plugins, skills for ADR-driven development, DevOps automation, ClickHouse management, semantic versioning, and productivity workflows

7🍴 1📅 2026年1月24日
GitHubで見るManusで実行

SKILL.md


name: mql5-indicator-patterns description: Develop custom MQL5 indicators with proper patterns. Use when creating indicators, debugging OnCalculate(), working with buffers, or implementing multi-timeframe indicators in MetaTrader 5. allowed-tools: Read, Grep, Edit, Write

MQL5 Visual Indicator Patterns

Battle-tested patterns for creating custom MQL5 indicators with proper display, buffer management, and real-time updates.

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:

  1. Explicit scale for small values (< 1.0 range)
  2. Hidden buffers for recalculation tracking
  3. New bar detection prevents rolling window drift
  4. Static variables maintain state efficiently
  5. Proper warmup calculation prevents misalignment
  6. Forward indexing for code clarity

These patterns solve the most common indicator development issues encountered in real-world MT5 development.


Reference Documentation

For detailed information, see:

スコア

総合スコア

65/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新

+5
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です