---
name: project-extract-settings-wic-2026-06-11
description: "WIC chart Part A — /extract-settings (MT4 .mq4 + Pine Script → indicator-dictionary parameters schema, client-side regex parser, no upload, no prediction)"
metadata: 
  node_type: memory
  type: project
  originSessionId: fc6723ce-88ad-401e-b6ce-fe0050f4190a
---

# WIC `/extract-settings` — Indicator Settings Extractor

## Why this matters

Per session 2026-06-09 plan (memory `project_session_2026-06-09_paper164_publish_and_source_code_theory_extraction.md`):

> "WIC chart Part A (MT4 .mq4 + Pine Script settings 抽出 dictionary upload tool)"

藤本さん expressed user-facing need: "settings/parameters extraction from MT4 .mq4 or Pine Script sources, output in dictionary schema for manual PR submission to honest-confluence-mt4/dictionary."

## What it does

- Client-side regex parser for **MT4 .mq4 (extern / input declarations)** + **TradingView Pine Script v4/v5 (input.* declarations)**
- Outputs JSON in same `parameters` schema as `/indicator-dictionary` (`Array<{ name, type, default }>`)
- File upload (drag/drop or input) OR paste textarea
- Auto-detect language + manual override
- Copy-to-clipboard + .json download buttons
- 100% client-side: no upload, no telemetry, no auto-submit

## What it does NOT do (honest scope)

- ❌ No execution / compilation / simulation of source code
- ❌ No upload of pasted source to any server
- ❌ No auto-submit to dictionary (manual PR remains required)
- ❌ No prediction, no signal, no investment advice
- ❌ Regex parser is common-form only; multi-line declarations, `#define`-driven defaults, dynamic input titles, `input.session()` / `input.symbol()` not handled cleanly (warnings emitted)

## Implementation

### Files (4 files, +835 lines)
- `src/pages/extract-settings.astro` (~400 lines): EN page with full UI + parser
- `src/pages/ja/extract-settings.astro` (~400 lines): JA mirror
- `src/pages/indicator-dictionary.astro` (+8 lines): discovery link from EN dictionary
- `src/pages/ja/indicator-dictionary.astro` (+8 lines): discovery link from JA dictionary

### Parser details
- **MQL parser**: regex `(extern|input)\s+(int|double|bool|string|color|...)\s+(\w+)\s*=\s*(.+?)\s*(?:;|\/\/|$)` + type normalization (int/long/short → 'int', double/float → 'float', ENUM_* → 'enum')
- **Pine v5 parser**: regex `(\w+)\s*=\s*input\.(int|float|bool|string|source|color|...)\s*\(\s*([^,)]+?)\s*(?:,\s*"([^"]*)")?[^)]*\)` + type normalization (integer/int → 'int', float/price → 'float')
- **Pine v3 fallback**: regex `(\w+)\s*=\s*input\s*\(\s*([^,)]+?)\s*(?:,...)?...(?:type\s*=\s*input\.(\w+))?...\)` + type inference from default value
- **default normalization**: type-aware (int → parseInt, float → parseFloat, bool → true/false, string → unquote)

### Language auto-detect
- MQL: first match of `(extern|input)\s+(int|double|bool|...|ENUM_)`
- Pine: first match of `\binput\.(int|float|bool|...)\s*\(` OR `^\s*\w+\s*=\s*input\s*\(`
- Unknown: fallback warning

## Build verify

- astro build: **464 pages / 29.68s / 0 errors**
- `dist/extract-settings/index.html` + `dist/ja/extract-settings/index.html` both verified

## Public URLs

- EN: `https://world-investment-center.pages.dev/extract-settings/`
- JA: `https://world-investment-center.pages.dev/ja/extract-settings/`
- Discovery: linked from `/indicator-dictionary` + `/ja/indicator-dictionary`

## commit

- WIC repo: `6471e76` (4 files +835 insertions, 0 deletions)

## Honest scope discipline (per永続原則)

Per [[feedback-financial-theory-archaeological-substrate]]:
- Extraction is **metadata-level** only (parameters/types/defaults)
- NO predictive claim, NO automatic dictionary write
- Dictionary submission remains a **manual PR** to honest-confluence-mt4 (curated registry)

Per [[feedback-mql4-lean4-zero-sorry-honest-scope]]:
- This tool **does not** translate to Lean 4 or claim zero-sorry verification
- This is a **shallow extraction tool**, not a deep theory extractor

Per [[feedback-no-rush-publication]]:
- v0.1 deployed without announcement campaign
- User-driven discovery via dictionary link

## Future scope (NOT in v0.1)

- Multi-line declaration support
- Constant expression evaluation (`#define` chains)
- Structured types (`input.session()` / `input.symbol()`)
- MQL5 advanced types (`MqlParam` struct)
- Reverse: dictionary entry → MT4/Pine source skeleton generator (Part B candidate)
- Aggregate stats: how many uploaded sources cover each canonical_class (research view, NOT auto-published)

## 関連

- [[project-session-2026-06-09-paper164-publish-and-source-code-theory-extraction]] — Part A origin plan
- [[feedback-financial-theory-archaeological-substrate]] — archaeological substrate framing
- [[feedback-mql4-lean4-zero-sorry-honest-scope]] — overclaim warning
- STEP 1196 WIC /indicator-theory — sibling page
- STEP 1200 /indicator-dictionary v0.1 — output target schema
