Strategies โ Master Overview¶
One page to orient fast: the ready-made orchestrators and presets that ship with GoMT4, how to pick one, and links to each spec.
โ ๏ธ Educational & demonstration only¶
The orchestrators and presets here are demonstration examples โ templates for building your own strategies, not production trading systems.
- Simplified logic, no portfolio-level risk controls, no economic-calendar integration.
- Demo accounts only. Study the code, test on demo, add your own risk management before considering anything live.
- Trading involves substantial risk of loss; you are responsible for your decisions.
They live in the repo under mt4/strategies/ and are driven by MT4Sugar (which composes MT4Service โ MT4Account). The examples app runs the demo via menu option 41.
๐ฆ Orchestrators¶
Each orchestrator is a single func Run*(ctx, sugar, sp, rp, โฆ) (int32, error) that takes a StrategyPreset (what / where to enter) and a RiskPreset (how much to risk / how to protect), runs the trade lifecycle, and returns the ticket.
| Orchestrator | Entry func | What it does |
|---|---|---|
| Market One-Shot | RunMarketOneShot(ctx, sugar, sp, rp) |
Size โ market BUY โ pip SL/TP bracket โ manage briefly โ close. |
| Bracket + Trailing | RunBracketTrailing(ctx, sugar, sp, rp, activateAtPips) |
Market entry + bracket; trailing stop switches on once price is far enough in profit. |
| Pending Bracket | RunPendingBracket(ctx, sugar, sp, rp, timeoutSeconds) |
Place a BUY LIMIT, wait for the fill (cancel on timeout), then bracket + manage. |
All three BUY for the demo, auto-size by risk (unless the preset pins Lots), and flatten at the end.
๐๏ธ Presets¶
Two small structs decouple what from how much:
StrategyPresetโ symbol, market/limit, entry price, fixed lots, magic, comment.RiskPresetโ risk %, SL/TP pips, trailing, breakeven.
Ready-made catalog: MarketEURUSD(), LimitEURUSD(price) ยท Conservative(), Balanced(), Aggressive(). See Presets.
๐ Running the demo¶
sugar := mt4.NewMT4Sugar(mt4.NewMT4Service(acc)).SetDefaults(777, 20, "demo")
// one protected market trade
ticket, err := strategies.RunMarketOneShot(ctx, sugar,
strategies.MarketEURUSD(), // WHAT
strategies.Balanced()) // HOW
Or run all three from the examples app: launch it and choose 41 (strategydemo.Demo).
๐ See also¶
- Market One-Shot ยท Bracket + Trailing ยท Pending Bracket ยท Presets
- Layers: MT4Sugar ยท MT4Service ยท MT4Account