Strategy Design

Discover the blueprint for successful algorithmic trading strategies. This section covers the logic behind profitable systems, including entry/exit rules, risk management models, and position sizing techniques. Learn how to transform raw trading ideas into structured algorithms ready for MQL5 implementation, avoiding common pitfalls like curve-fitting.

Trailing stops in MQL5: how to lock in profit without choking your winners

Trailing stops in MQL5: how to lock in profit without choking your winners

I once had a long on GBPJPY that was up about 70 pips. Nice trade. I'd bolted on a trailing stop the night before, set it to follow 12 pips behind price, and went to bed feeling clever. By morning the position was closed for a 9-pip gain, and the pair had run another 180 pips in my direction without me. The trailing stop did exactly what I told it to: it strangled the trade on the first pullback. That's the whole problem with trailing stops in one story - set them too tight and they turn your best trades…
Read More
Risk management in MQL5: position sizing and stops that survive a losing streak

Risk management in MQL5: position sizing and stops that survive a losing streak

A few years back I had an EA with a 68% win rate in the tester. It looked fantastic. I dropped it on a small live account at a flat 0.20 lots per trade, left it running, and came back a week later to a 41% drawdown. The signals had behaved - roughly what the backtest promised. What drained the account was that I'd hard-coded the lot size and paid no attention to how far the stop sat from entry. A few wide-stop losers in a row, every one of them sized exactly like the tight-stop winners, and the arithmetic…
Read More
MQL5 from scratch: How to code your first Expert Advisor

MQL5 from scratch: How to code your first Expert Advisor

Automating a trading strategy is one of the biggest milestones in a trader’s development. Instead of manually clicking buy and sell, you let a program execute your rules automatically, without fear, greed, or fatigue. In the MetaTrader 5 ecosystem this program is called an Expert Advisor (EA), and it is written in the MQL5 programming language. This article walks you step by step through coding your first Expert Advisor in MQL5. You will learn: What MQL5 and Expert Advisors are How an EA is structured How to use built-in indicators (Moving Averages) How to open and manage trades from code…
Read More
Risk first, profit second: Position sizing methods that actually survive drawdowns

Risk first, profit second: Position sizing methods that actually survive drawdowns

The harsh reality of forex trading reveals itself not in the moments of victory, but in the inevitable periods of drawdown when equity curves bend downward and psychological pressure mounts. Most traders approach position sizing as an afterthought, focusing instead on entry signals and technical patterns. This inverted priority structure explains why the majority of retail forex accounts deplete within their first year of trading. Position sizing represents the single most critical determinant of long-term survival in forex markets. It functions as the mathematical governor that prevents catastrophic losses while allowing sufficient exposure to capture meaningful returns. The difference between…
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
Architecting the ideal forex trading system: a technical guide

Architecting the ideal forex trading system: a technical guide

Designing a durable Forex trading bot is equal parts economics, statistics, market microstructure, and software engineering—and it fails if any one of those pillars is weak. “Durable” means the system remains profitable and controllable across regime shifts (risk-on/off, volatility spikes, liquidity droughts), survives realistic costs (spreads, swaps, slippage, last-look), and resists model drift and data pathologies. It also means decisions are explainable, risks are bounded, and operations are resilient to outages and bad ticks. This article extends the prior framework by shifting from “what to build” to “how it survives.” We’ll translate economic hypotheses into testable signals, enforce honest validation…
Read More