Discussing the article: "Position Management: Safe Pyramiding with a Unified Stop in MQL5"

 

Check out the new article: Position Management: Safe Pyramiding with a Unified Stop in MQL5.

This article presents CPyramidEngine, a reusable MQL5 class that adds disciplined pyramiding to any Expert Advisor with about six lines of integration. The engine enforces three constraints: strictly decreasing lot sizes, a single unified stop that advances after each add-on, and broker-level validation of every modification. It explains common failure modes in naive implementations and shows how to keep total account risk quantifiable and controlled as positions are added.

Pyramiding—adding to a winning trade as it moves in your favor—is one of the most effective position-management techniques available to an algorithmic trader. When a trend produces a sustained directional move, a pyramid can turn a single entry into a compounding structure that extracts maximum value from the move. When implemented without discipline, that same technique can destroy an otherwise profitable trade in a single reversal.

This article delivers a reusable, self-contained MQL5 class called CPyramidEngine. Any expert advisor can plug it in with roughly six changes to existing code. The entry signal belongs to your EA. The engine handles everything else: add-on triggers, lot sizing, the unified stop, state recovery after restart, external close detection, and all broker-level validation.

Before showing what the engine does, this article explains why it is built this way. Every design decision in "CPyramidEngine" exists because of a specific failure mode in naive pyramiding implementations. Understanding those failure modes is what separates a developer who can use this engine from one who can truly trust it—and adapt it when conditions require.

Author: Tola Moses Hector

 

Hello thx for sharing your ea.

im sorry that pad should be in the PyramidEA folder.

can you edit it?

Save to "MQL5\Include\Pyramid\PyramidEngine.mqh."


im testing now