metatrader

MQL5 explained: OnInit, OnDeinit, OnTick – The core of every Expert Advisor

MQL5 explained: OnInit, OnDeinit, OnTick – The core of every Expert Advisor

If you understand OnInit, OnDeinit and OnTick, you understand the heart of every MQL5 Expert Advisor.Everything else – indicators, money management, signals – lives inside or around these three functions. In this article we’ll go deep: What each function really does and when it is called What belongs in which function (and what absolutely doesn’t) Professional patterns for resource management, order logic and debugging Full code examples, including run-once-per-bar logic and clean shutdown The goal is that, after reading this, you can look at any EA and immediately see whether its lifecycle is designed properly. 1. The Event-Driven Model of…
Read More
Perfect Forex Trading System in MetaTrader 5 (MQL): What Elements Should It Include?

Perfect Forex Trading System in MetaTrader 5 (MQL): What Elements Should It Include?

Designing a durable MT5 system is not about a clever entry. It’s a production problem that spans economics (why it works), statistics (proof it works), market microstructure (costs & execution), and software engineering (so it keeps working). Below is a practitioner’s blueprint—concepts, guardrails, and concrete MQL5 patterns—to build a system that survives regime shifts, costs, and live operations. 1) Economic Thesis → Strategy Design Non-negotiable: every rule must trace back to an economic hypothesis or a repeatable behavioral pattern. Macro/structural edges: carry (rate differentials), terms-of-trade proxies (commodity FX), policy path repricing (OIS/expectations), risk-on/off cycles. Behavioral/technical edges: trend persistence (session flows),…
Read More