Skip to content
Agentmart
Submit a tool

mql5-from-pinescript

Port TradingView Pine Script indicators to MQL5.

Skill by ZhijuCen

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/zhijucen-mql5-from-pinescript

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Port TradingView Pine Script indicators to MQL5. Fetch open-source Pine via the pine-facade endpoint (no login/browser), map Pine constructs (offsets, fill, plotshape, request.security, alertcondition, var-state) onto MQL5 buffers/chart objects with a shift-invariance + closed-bar state-machine model, compile via mql5_helper, and record every deviation.

Use cases: data, security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mql5-from-pinescript

What's inside

Skill name
mql5-from-pinescript
Description
Port TradingView Pine Script indicators to MQL5. Fetch open-source Pine via the pine-facade endpoint (no login/browser), map Pine constructs (offsets, fill, plotshape, request.security, alertcondition, var-state) onto MQL5 buffers/chart objects with a shift-invariance + closed-bar state-machine model, compile via mql5_helper, and record every deviation.
License
MIT
Metadata
version: 0.1
Instructions
183 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (51)

  • SKILL.md
  • 0004-supertrend-regime-confluence.ini · assets/mql5-side/
  • 0005-macd-pullback-sniper.ini · assets/mql5-side/
  • 0006-aurora-kama.ini · assets/mql5-side/
  • BufferDump-EA.mq5 · assets/mql5-side/
  • parity_0002.ini · assets/mql5-side/
  • AdaptiveDecyclerSupertrend.mq5 · assets/mql5/
  • AuroraKamaTrend-EA.mq5 · assets/mql5/
  • DirectionalKernelFilter.mq5 · assets/mql5/
  • MACDPullbackSniper-EA.mq5 · assets/mql5/
  • ModernIchimokuCloud.mq5 · assets/mql5/
  • SuperTrendRegimeConfluence-EA.mq5 · assets/mql5/
  • strategy-common.mqh · assets/mql5/
  • PROVENANCE.md · assets/pine-scripts/
  • adaptive-decycler-supertrend.pine · assets/pine-scripts/
  • aurora-kama.pine · assets/pine-scripts/
  • directional-kernel-filter.pine · assets/pine-scripts/
  • macd-pullback-sniper.pine · assets/pine-scripts/
  • modern-ichimoku-cloud.pine · assets/pine-scripts/
  • supertrend-regime-confluence.pine · assets/pine-scripts/
  • README.md · references/pine-script-docs/
  • concepts-alerts.md · references/pine-script-docs/
  • concepts-bar-states.md · references/pine-script-docs/
  • concepts-chart-information.md · references/pine-script-docs/
  • concepts-inputs.md · references/pine-script-docs/
  • concepts-other-timeframes-and-data.md · references/pine-script-docs/
  • concepts-repainting.md · references/pine-script-docs/
  • concepts-strategies.md · references/pine-script-docs/
  • concepts-timeframes.md · references/pine-script-docs/
  • faq-strategies.md · references/pine-script-docs/
  • faq-variables-and-operators.md · references/pine-script-docs/
  • language-built-ins.md · references/pine-script-docs/
  • language-execution-model.md · references/pine-script-docs/
  • language-type-system.md · references/pine-script-docs/
  • language-variable-declarations.md · references/pine-script-docs/
  • reference-drawing.md · references/pine-script-docs/
  • reference-input.md · references/pine-script-docs/
  • reference-misc.md · references/pine-script-docs/
  • reference-plotting.md · references/pine-script-docs/
  • reference-strategy.md · references/pine-script-docs/
  • reference-ta.md · references/pine-script-docs/
  • pine-to-mql5.md · references/
  • 0001-modern-ichimoku-cloud.md · references/ports/
  • 0002-adaptive-decycler-supertrend.md · references/ports/
  • 0003-directional-kernel-filter.md · references/ports/
  • 0004-supertrend-regime-confluence.md · references/ports/
  • 0005-macd-pullback-sniper.md · references/ports/
  • 0006-aurora-kama.md · references/ports/
  • check_0002_parity.py · scripts/
  • extract_pine.py · scripts/
  • fetch_pine_docs.py · scripts/

SKILL.md (first lines)

# Pine Script → MQL5 Porting Skill

Turn an open-source TradingView Pine indicator into an MQL5 indicator
(`.mq5`, chart window or subwindow) with an explicit, recorded fidelity
contract. Ports live in `assets/mql5/`; the fetched Pine original is kept
verbatim in `assets/pine-scripts/` as the fixed source asset.

## When to use

- User points at a TradingView script URL and wants it in MQL5/MT5.
- A Pine port needs review: fidelity check, deviation audit, re-compile.
- deciding whether a script is portable at all (open-source? plots only?
  drawing-heavy? repainting strategies are out of scope).

Out of scope: closed-source scripts (masked) — ask the user for the Pine
source; never decompile or screenshot-transcribe. Pine *strategies*
(`strategy.*`, order simulation) port to an **EA** only after the user
asks for trading logic; this skill's default target is indicators.

## Step 1 — Fetch the Pine source (open-source first)

```bash
# writes the verbatim source + prints metadata
python skills/mql5-from-pinescript/scripts/extract_pine.py fetch \
  "https://www.tradingview.com/script/<id>-<slug>/" \
  -o skills/mql5-from-pinescript/assets/pine-scripts/<name>.pine

# later: prove the asset still matches the published source
python .../extract_pine.py fetch "<url>" --check assets/pine-scripts/<name>.pine
```

How it works: page HTML embeds `"script_id_part":"PUB;<hex>"` →
`https://pine-facade.tradingview.com/pine-facade/get/PUB%3B<hex>/1`
returns JSON with `source`, `scriptAccess`, `version`.
(`scriptAccess != "open_no_auth"` → warn, source may be masked.)

**Never** copy from the rendered code viewer: it renders spaces as
U+00A0 and silently corrupts the file (this happened — see
`assets/pine-scripts/PROVENANCE.md`). Also record provenance (URL, id,
version, fetch date, normalization) in a `PROVENANCE.md` next to the
asset.

## Step 2 — Triage before writing code

Read the whole Pine file once. Classify every construct:

| Class | Examples | Port strategy |
|-------|----------|---------------|
| Direct | `plot`, math, `input.*`, crossovers | buffers + `input` (mapping table below) |
| Shifted plot | `offset=±k` | value remap at write time, EMPTY slots where data doesn't exist yet |
| Fill | `fill()` | `DRAW_FILLING` (only 2 dynamic colors — see D1 pattern) |
| Shapes/labels/tables | `plotshape`, `label`, `table` | `DRAW_ARROW` / `OBJ_TEXT` / `OBJ_LABEL` grid |
| Background | `bgcolor` | impossible → corner readout, record deviation |
| MTF | `request.security` | hand-built HTF series + closed-bar margin |
| State | `var`, `barstate.isconfirmed` | one state class + closed-bar state machine |
| Alerts | `alertcondition` | `Alert()` on realtime-closed bars only |
| Strategy orders | `strategy.entry/exit` | out of scope (EA, ask user) |

Estimate object counts (`line`/`label`/`table` creations): every Pine
object becomes a chart object — cap them (FIFO) or drop the feature and
record it.

## Step 3 — Apply the mapping

Full table + rules: `references/pine-to-mql5.md`. When a construct's
semantics are unclear, consult the curated excerpts in
`references/pine-script-docs/` (manual pages + API entries actually
used by ports — see its README) before guessing. The four rules that
decide correctness:

1. **Shift-invariance** — displayed values are intrinsic per bar; compute
   once, let MT5's buffer shifting carry them. Refresh only index 0 (per
   tick) and slots whose supplier bar was just born.
2. **Closed-bar state machine** — `var`/`isconfirmed` logic runs exactly
   once per closed bar, chronologically, guarded by
   `m_lastProcessedTime`; bulk backfill on the first call.
3. **Realtime-only alerts** — backfill accumulates, never alerts.
4. **ATR parity** — Pine `ta.atr` is Wilder RMA; MQL5 `iATR` is SMA of
   TR. Compute RMA inline; never use `iATR` when the port must match TV.

## Step 4 — Write the `.mq5`

- Target path: `skills/mql5-from-pinescript/assets/mql5/<Name>.mq5`.
- Follow the MQL5 code style (`skills/mql5/references/quick-ref-code-style.md`):
  PascalCase functions/methods, `C`+PascalCase classes, `m_`+camelCase
  members, ALL_CAPS constants, K&R braces, 4-space indent.
- One state class for `var` state (members reset in `OnInit`, objects
  deleted in `OnDeinit` via `ObjectsDeleteAll(chart, prefix)`); free
  functions for pure math (blend, percentile, RMA, bounds-checked
  highest/lowest).
- Every input mirrors a Pine input 1:1 (same default!) under an
  `input group` / `[Group]` comment matching Pine's `group = ...`.
- Header comment block: port number, Pine source path, deviations
  summary (D-numbers from the port record).

## Step 5 — Compile & verify

```bash
python skills/mql5/scripts/mql5_helper.py check  assets/mql5/<Name>.mq5
python skills/mql5/scripts/mql5_helper.py compile assets/mql5/<Name>.mq5
```

Wine exit 0 ≠ success: require a fresh `.ex5` + `.log` next to the source
(Pitfall #17 in `skills/mql5/SKILL.md`). Then run the checklist in
`references/pine-to-mql5.md` §5 — the two invariants that catch most
port bugs:

- **idempotence**: no new bar ⇒ no buffer/object changes;
- **no repaint**: a closed bar's values/objects never change afterwards.

## Step 6 — Record the port

Create `references/ports/NNNN-<name>.md` (zero-padded, next free number)
with: source/port/provenance table, faithful list, ATR/semantics
decisions, **numbered deviations D1…Dn (mandatory, even when empty)**,
and open verification tasks. Register the port id in this SKILL.md's
`metadata.ports`.

## Layout

From ZhijuCen/mql5-skills, MIT.

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Sep 22, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
0.1
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ZhijuCen

Cite this page

mql5-from-pinescript skill. Agent Mart. https://agentmart.dev/skills/zhijucen-mql5-from-pinescript (last updated 2026-10-24)