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
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
Save to "MQL5\Include\Pyramid\PyramidEngine.mqh."
It's an instruction, in order to keep your Include folder tidy. Simply create a new folder named Pyramid under the Include folder, then copy the two .mqh files to that folder that's it.
But of course, you can save to any folder of your choice. Just remember to make relevant changes also to the EA to point to that specific folder.
tks you Tola Moses Hector
Thank you for your article. I’ve started working on position management,
Having had a quick look at your code, there might be a small issue with the GetPositionTicketFromLastDeal() method, which uses the m_trade.ResultDeal() method,
If the server lags a little, we’ll get 0,
For example, you could use a while loop with 10 attempts and a short time interval of 50 milliseconds for each attempt
Best Reguards,
ZeroCafeine 😉
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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