Skip to content

Development Guide

André Borchert edited this page Sep 13, 2026 · 7 revisions

Development Guide

FXNews intentionally keeps its implementation in FXNews.mq5. Prefer focused function-level changes unless a larger refactor has a clear maintenance benefit. Preserve #property strict, chart-window indicator behavior, and the timer-driven scan path unless the product design changes deliberately.

Local Workflow

  1. Edit FXNews.mq5 or the relevant wiki page.
  2. Compile. On macOS run ./tools/build-macos.sh; elsewhere compile FXNews.mq5 in MetaEditor.
  3. Run tools/census.py (dead-code and placeholder census) and, on macOS, ./tools/selftest-macos.sh (headless self-test); both must exit 0.
  4. Attach the indicator to a chart in a demo or other non-production terminal.
  5. Run the focused checks described in Testing and Validation.
  6. Keep generated MetaTrader artifacts out of Git.

tools/build-macos.sh drives MetaEditor through the Wine bundle that ships inside the MetaQuotes macOS build of MetaTrader 5. It resolves the compiler and prefix, converts macOS paths to the prefix's Z: drive mapping, decodes MetaEditor's UTF-16LE log, aborts after BUILD_TIMEOUT seconds (default 300) if MetaEditor hangs, and exits non-zero on any error or warning, so it is usable as a commit gate. --install copies the compiled FXNews.ex5 into the terminal's MQL5/Indicators/FXNews/ folder after a clean build. Exit codes: 0 clean, 1 errors or warnings, 2 environment problem, 3 no result line, 4 timeout. It is macOS-only and assumes the standard install locations:

wine64    /Applications/MetaTrader 5.app/Contents/SharedSupport/wine/bin/wine64
compiler  ~/Library/Application Support/net.metaquotes.wine.metatrader5/
            drive_c/Program Files/MetaTrader 5/MetaEditor64.exe

Beyond that there is no repository-local install, lint, typecheck, format, test, migration, Docker, or deployment command. MetaEditor compilation is the available syntax and type validation path. The release and distribution process is not currently documented.

What the compiler will not catch

The MQL5 compiler warns only about a variable that is never touched at all. Anything that is written — including by an initialiser — counts as used. Verified by probe: an initialised-but-unread local, a struct copied into a local and never read, a struct field assigned but never read, a tautological comparison, and an unreachable statement after return all compile with zero warnings. Three real defects fixed in 1.4 lived in exactly that gap. Do not treat a clean build as dead-code clearance; run the census in Testing and Validation.

Change Areas

Inputs and Defaults

Review the input declarations, InitializeRuntimeSettings(), and ValidateInputs(). Defaults affect every symbol/timeframe profile and the historical-validation baseline. Update Configuration when user-visible settings change.

Symbols and Timeframes

Review SymbolsToScan, TimeframesToScan, ParseSymbols(), ParseTimeframes(), ParseTimeframeToken(), TimeframeMinutes(), and FindBrokerSymbolMatch(). Keep parsing, labels, duplicate detection, broker suffix/prefix handling, and historical aggregation aligned.

Scoring

Start with the relevant evaluator and then inspect BuildCompositeSignalScore() for weights and caps. Keep compact tags, human-readable reasons, live scoring, and historical scoring aligned where their models are intended to match. Material changes require both live observation and historical validation.

Dashboard

Review dashboard constants plus UpdateDashboard(), CollectDashboardSignals(), SortDashboardSignals(), formatting helpers, FitDashboardText(), and CleanupDashboardObjects(). Test different chart widths, row limits, diagnostics, blocked-signal mode, and recent-history fallback.

Alerts

Review EnableSoundAlert, EnablePushNotification, alert state, cooldowns, and SendOptionalAlert(). Alerts must remain opt-in. Test deliberately in a non-production terminal and check for duplicate or repeated notifications.

Validation and Autotune

Review RunHistoricalOperatingMode(), RunHistoricalBacktest(), historical score helpers, candidate construction, the objective function, and Journal report builders. Autotune recommendations must remain advisory; results depend on broker history quality and must not be presented as proof of future performance.

Repository Conventions

  • Use source code as the authority when documentation differs.
  • Never let a component that could not be evaluated read as confirmation. A neutral placeholder value must not be able to satisfy a threshold that means "confirmed": carry an explicit availability flag and gate the tag and the wording on it.
  • No placeholder or filler text in anything the user sees. A format slot with a constant in it is a defect, not a label.
  • Keep score wording factual: the percentage is an event-quality ranking, not a win probability or trade recommendation.
  • Avoid unbounded work in OnTimer() and ScanAll().
  • Validate CopyRates and CopyTicks results before accessing returned arrays.
  • Keep chart-object names scoped through the indicator's per-chart prefix.
  • Do not commit *.ex5, logs, tester output, profiles, caches, or temporary files.
  • Update the wiki when behavior, settings, safety boundaries, validation, or operating procedures change.
  • Complete the Release Checklist before publishing a production revision.

Clone this wiki locally