πΊοΈ 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.workties the modules together)package/β modulegithub.com/MetaRPC/GoMT4/package*.pb.goβ vendored protobuf / gRPC stubs (AccountHelper,TradingHelper,MarketInfo,Subscriptions, β¦)
mt4/β modulegithub.com/MetaRPC/GoMT4/mt4β the SDKMT4Account.goβ Layer 1 β MT4Account overviewmt4service.goβ Layer 2 β MT4Service overviewmt4sugar.goβ Layer 3 β MT4Sugar overviewstrategies/β orchestrators + presetspresets.goβStrategyPreset,RiskPreset, catalog,sizeLot,managemarket_one_shot.goΒ·bracket_trailing.goΒ·pending_bracket.go
examples/β modulegithub.com/MetaRPC/GoMT4/examplesβ the runnable appmain.goβ the interactive menu (connects once, dispatches to the demos)config/βconfig.jsonloadercommon/β shared demo helpers (ReadStream,Ptr, trading flag)1_lowlevel/β MT4Account demos (general,trading,streaming)2_service/β MT4Service demo3_sugar/β MT4Sugar demos (basics,trading,positions)4_strategies/β orchestrator demoprotobuf_inspector/β the offline type explorer
π Documentation tree¶
docs/- Home β landing page
All_Guides/β the guides (Getting Started, Your First Project, MT4 for Beginners, Glossary, Concurrency Model, gRPC Streaming, ENUMs, Return Codes, Protobuf Inspector)MT4Account/Β·MT4Service/Β·MT4Sugar/β the three layer overviewsstyles/Β·javascripts/Β·includes/β theme assets
π― 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.