MetaEditorのヘルプ → MCP and AI → Examples → Deploying Expert Advisors, Indicators, and Scripts

Deploying Expert Advisors, Indicators, and Scripts Using AI

Adapt file names, symbols, periods, risk limits, and requirements to your project or preferences. Preserve an unchanged baseline and test the algorithm in a demo environment before live use.
 
You are solely responsible for AI-generated content, AI-assisted actions, trading decisions, trading results, and any resulting losses.

Indicator buffer contract test:

For TrendSMA.mq5 on EURUSD H1, independently calculate buffer 0 for 10 selected closed-bars from the latest 40, including the first valid value after warm-up. Compile and attach it with Period=20, read its effective inputs and buffer, correct the first timestamped mismatch, repeat once, then remove it and close the created chart.

EA-indicator integration contract:

Identify the symbol, timeframe, buffer, shift, and completed-bar rule GoldTrend.mq5 expects from TrendSMA. On EURUSD H1, attach TrendSMA with Period=20, then attach GoldTrend with ObserverMode=true. Compare the EA journal with 10 visible buffer timestamps, correct one proven handle or indexing mismatch, and remove both programs.

Script postcondition and idempotency test:

On a test EURUSD M15 chart, record attached programs and parameters before running ChartCleanup.mq5. Define its expected changes and preserved state, run it once, inspect the journal and chart inventory, then run it again unchanged. Classify the second result as safe no-op, repeatable update, or duplicate operation, and restore the original chart state.

Reinitialization lifecycle test:

Compile the non-trading RiskPanel.mq5 with lifecycle logging. On USDJPY M15, attach it with Period=14, remove it, reattach with Period=20, and remove it again. After each action, inspect chart inventory and the Experts journal. Verify one matching initialization and cleanup per attachment, with no duplicated timer, handle, or chart object.

Parameter-schema migration:

Compare at most 15 inputs exposed by GoldTrendV1.ex5 and GoldTrendV2.ex5. Classify unchanged, renamed, type-changed, added, and removed inputs, then create a reviewed migrated SET file. Run both versions on the same one-day EURUSD H1 configuration and explain the first behavioral difference. Reject migration if any safety input remains ambiguous.

Tester-to-chart configuration handoff:

Run RangeBreakout.ex5 on EURUSD M15 for the previous trading day using Open prices and retrieve its configuration and report. Build the same version, open EURUSD M15, attach it with ObserverMode=true and the tested inputs, read back effective parameters and startup messages, list tester-only differences, then remove it and close the created chart.

Compiled release smoke test:

Build SessionGuard.mq5 with no diagnostics, then run a one-day EURUSD M15 Open-prices test. Reject initialization, numeric, permission, data, or resource errors from the report and journal. Attach it to one demo chart with ObserverMode=true, verify effective inputs and startup messages, remove it, and record the source version, configuration, report, and findings.

Safe single-chart EA deployment:

Compile RangeBreakout.mq5, open EURUSD M15 on the demo terminal, and read its exact inputs. Set RiskPercent=0.25, LookbackBars=20, EntryMode=1, and MagicNumber=260924. Attach it with automated trading disabled, verify the applied values, inspect two minutes of Experts journal entries, and remove it if initialization reports an error.

Exact EA parameter cloning:

Read every actual input from SessionGuard attached to the EURUSD M15 chart. Open GBPUSD M15 and attach a second instance with identical values except Symbol=GBPUSD and MagicNumber=260925. Verify both instances from their chart parameters, inspect one minute of journal output, then remove only the GBPUSD clone and close its chart.

Calendar-aware deployment window:

Using server time, check for high-impact EUR or USD events during the next two hours before deploying LondonBreakout.ex5 to EURUSD M15. If an event exists, prepare the chart and exact inputs but do not attach. Otherwise attach with automated trading disabled, verify initialization for two minutes, and report the decision.

Deployment package inventory:

Confirm that RangeBreakout.ex5, TrendSMA.ex5, and SymbolAudit.ex5 are available as an EA, indicator, and script. Read each program's actual input schema, including enum numeric codes and defaults. Report missing binaries, ambiguous parameters, or type mismatches, and make no chart or account changes.

Three-symbol staged EA rollout:

On a demo account with automated trading disabled, open EURUSD, GBPUSD, and USDJPY M15 charts. Attach RiskGuard.ex5 with RiskPercent=0.20 and unique magic numbers 260931, 260932, and 260933. Confirm the exact parameters and symbol on each chart, then report any initialization or symbol-property warning from the latest two journal minutes.

EA hot-swap and rollback:

On the demo XAUUSD H1 chart, snapshot every GoldTrendV1 input, then remove it. Compile GoldTrendV2.mq5 and attach it with the same values and automated trading disabled. Inspect two minutes of Experts output; if OnInit fails or inputs differ, remove V2 and reattach V1 from the snapshot.

Template-based workspace deployment:

Open a demo USDJPY H1 chart and apply TrendWorkspace.tpl with automated trading disabled. Inventory the EA and indicators loaded by the template and read their actual inputs. Verify one minute of terminal and Experts journals, then remove the loaded EA and indicators and close only the chart created.

Indicator bundle deployment:

Open EURUSD H1 and attach RSI with period 14, ATR with period 14, and TrendSMA with period 20 using their exact parameter names. Read the latest 10 visible values from each buffer, remove only ATR, and verify RSI and TrendSMA remain attached before closing the created chart.

Indicator configuration cloning:

Read the exact inputs and latest 10 buffer values of VolatilityBands attached to GBPUSD M15. Open EURUSD M15, attach the same indicator with identical inputs, and confirm its buffers are nonempty and timestamp-aligned. Remove the clone and close EURUSD M15 without changing the original GBPUSD indicator.

Custom indicator upgrade parity:

On EURUSD H1, snapshot TrendSMA V1 inputs and its latest 20 closed-bar values. Compile TrendSMA V2, replace V1 with V2 using identical inputs, and compare the same timestamps. Keep V2 only if values match within 0.00001 and no journal errors occur; otherwise restore V1.

One-shot diagnostic script run:

Compile SymbolAudit.mq5, open XAUUSD H1, and read the script's exact inputs. Set Volume=0.10, StopPoints=500, and CheckMode=2, then run it once. Read the terminal journal for its OnStart result code and latest 20 messages, confirm it placed no orders, and close only the chart created.

Market Watch batch script:

Record whether EURUSD, GBPUSD, and USDJPY are already in Market Watch, add any missing symbols, and run SnapshotExport.mq5 once on EURUSD H1 with BarsPerSymbol=50 and OutputMode=1. Verify its journal result code and three-symbol summary, then close the chart and restore the original Market Watch membership.

Account-aware deployment gate:

Before attaching PairsTrader.ex5 to EURUSD H1, inspect account mode, margin level, and existing EURUSD and GBPUSD positions and orders. Continue only if margin exceeds 300 percent and magic number 260940 is unused. Attach with Symbol2=GBPUSD and automated trading disabled, verify inputs, and report the gate decision.

Targeted deployment cleanup:

Inventory every open chart with its attached EA and indicators. On GBPUSD M15 only, snapshot all parameters, remove TestHarness EA and DebugBands from subwindow 1, and leave every other application unchanged. List the chart again, confirm both targets are absent, and report the exact before-and-after state.