MQL4 and MQL5 Programming Articles

icon

Study the MQL5 language for programming trading strategies in numerous published articles mostly written by you - the community members. The articles are grouped into categories to help you quicker find answers to any questions related to programming: Integration, Tester, Trading Strategies, etc.

Follow our new publications and discuss them on the Forum!

Add a new article
latest | best
preview
MQL5 Bootstrap (IV): Trailing and Break-even Stop Helpers

MQL5 Bootstrap (IV): Trailing and Break-even Stop Helpers

This article presents reusable MQL5 utilities for managing trailing and break-even stops. It covers fixed-point, moving average, ATR, Parabolic SAR, money-based, and time-periodic trailing, plus break-even by points and by money, with activation thresholds, step logic, reverse-move protection, and broker-level validation. Code examples and Bootstrap classes show how to integrate these helpers into Expert Advisors to standardize position control and reduce duplicate code.
preview
Automating Classic Market Methods in MQL5 (Part 6): Jesse Livermore's Pivotal Point System

Automating Classic Market Methods in MQL5 (Part 6): Jesse Livermore's Pivotal Point System

This article presents a complete MQL5 Expert Advisor that implements Jesse Livermore's market key as a deterministic state machine. It detects pivotal levels from consolidations using ATR and volume expansion, scales in across four tranches, and exits on abnormal behavior defined by range and volume. The EA validates inputs in OnInit, requires a hedging account, and compiles out of the box for testing Livermore's rules on daily data.
preview
Building Your Personal Expert Advisor (Part 4): Risk Management III—Risk Models and Order Execution

Building Your Personal Expert Advisor (Part 4): Risk Management III—Risk Models and Order Execution

The EA now defines risk by percentage, fixed cash, or fixed lot and can measure percentage against balance or equity. It supports market, limit, and stop orders, sizes from the planned entry, and enforces spread‑aware stop minima. Additional safeguards include downward volume rounding, explicit handling when the minimum lot exceeds target risk, and pending‑order distance/expiry checks, organized under a Plan–Validate–Execute structure.