Skip to content

πŸ—ΊοΈ GoMT4 Project Map

The whole project as one annotated tree, with links. Links point to section overviews, never to individual method pages β€” open an overview to drill down into its methods.


🧱 The three layers

GoMT4 is built in three decoupled layers (composition, not inheritance). Your code can enter at any level.

Layer Source What it does Overview
3 Β· MT4Sugar mt4/mt4sugar.go Convenience on top of Service: risk-based sizing, pip-based SL/TP, price/volume helpers, trailing & breakeven, watchers, order queries. MT4Sugar overview
2 Β· MT4Service mt4/mt4service.go Typed facade: unwrapped returns (slices/scalars) and simpler arguments over MT4Account. What most code uses. MT4Service overview
1 Β· MT4Account mt4/MT4Account.go Low-level gRPC: builds each proto …Request, attaches auth metadata, returns (*pb.…Data, error); connection, retry & streaming. Everything builds on it. MT4Account overview
Your code β†’ MT4Sugar β†’ MT4Service β†’ MT4Account β†’ gRPC β†’ MetaRPC gateway β†’ MT4 terminal

Mix freely: sugar.Service() borrows the Service, svc.Account() borrows the Account.


🌳 Repository tree

GoMT4 is a Go workspace (go.work) of three modules:

  • GoMT4/ β€” repo root (go.work ties the modules together)
  • package/ β€” module github.com/MetaRPC/GoMT4/package
    • *.pb.go β€” vendored protobuf / gRPC stubs (AccountHelper, TradingHelper, MarketInfo, Subscriptions, …)
  • mt4/ β€” module github.com/MetaRPC/GoMT4/mt4 β€” the SDK
    • MT4Account.go β€” Layer 1 β†’ MT4Account overview
    • mt4service.go β€” Layer 2 β†’ MT4Service overview
    • mt4sugar.go β€” Layer 3 β†’ MT4Sugar overview
    • strategies/ β€” orchestrators + presets
    • presets.go β€” StrategyPreset, RiskPreset, catalog, sizeLot, manage
    • market_one_shot.go Β· bracket_trailing.go Β· pending_bracket.go
  • examples/ β€” module github.com/MetaRPC/GoMT4/examples β€” the runnable app
    • main.go β€” the interactive menu (connects once, dispatches to the demos)
    • config/ β€” config.json loader
    • common/ β€” shared demo helpers (ReadStream, Ptr, trading flag)
    • 1_lowlevel/ β€” MT4Account demos (general, trading, streaming)
    • 2_service/ β€” MT4Service demo
    • 3_sugar/ β€” MT4Sugar demos (basics, trading, positions)
    • 4_strategies/ β€” orchestrator demo
    • protobuf_inspector/ β€” the offline type explorer

πŸ“š Documentation tree


🎯 Which layer should you use?

  • Most trading apps β†’ MT4Sugar. Risk sizing, pip math and bulk ops out of the box.
  • Custom execution β†’ MT4Service. Clean returns when you manage your own request shapes.
  • Protocol-level control β†’ MT4Account. Raw proto structures and streams.