Start Here: Learn MT5 and MQL5 with Practical Examples

Technical revision: 1 October 2026 · Educational material

Use this route to build an MT5 program you can explain and inspect. Start with a non-trading logger, then move to signals, sizing and demo execution. The site publishes educational examples; it does not provide broker services, personal investment advice or a verified profitable trading robot.

Follow the learning route

  1. Understand the program lifecycle. Read OnInit, OnTick and OnDeinit. Compile the logger and inspect completed-bar observations.
  2. Read indicator values consistently. Use CopyBuffer and closed-bar ordering, then build a custom indicator.
  3. Implement a precise signal. Follow the closed-bar demo EA. Keep order submission off while checking the rule.
  4. Check exposure and broker constraints. Read position sizing and order-error diagnostics.
  5. Evaluate without changing the past. Apply the backtesting checklist and retain code versions, input sets and reports.

Download the learning source

File Purpose
FtsLifecycleDemo.mq5 Non-trading closed-bar logger.
FtsClosedBarMAEA.mq5 EMA-crossing demonstration, execution off initially and restricted to demo/tester.
FtsRisk.mqh Estimated stop-based size and tick-grid rounding.
FtsMADistance.mq5 Chronological custom indicator.
FtsTrailingDemo.mq5 Filtered trailing-stop demonstration; management off initially.
FtsSymbolDiagnostics.mq5 Specification snapshot without trade submission.
INSTALL.txt Folder placement, inputs and verification steps.

What has been verified

Version 1.0, dated 1 October 2026, has been reviewed against the cited MQL5 reference and checked for selected arithmetic/indexing invariants. MetaEditor compilation and execution in MT5 have not been verified for this release. Compile locally and resolve errors before use. No backtest performance is claimed.

The default example inputs are illustrative. Gaps, slippage, fees and contract changes can make realized results differ from estimates. Use Strategy Tester or an isolated demo environment for learning.

Browse by topic