Pipsgrowth EX12060 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX12060 G4_7 — Secure Momentum Pyramid with EMA+ADX, full 12-layer stack.
Overview
EX12060 is a single-symbol momentum pyramid that rides trends hard and gets out fast. It loads three indicators on the current chart — a 20-period EMA, a 50-period EMA, and a 14-period ADX — and only opens the first ticket of a new trend when the fast EMA is on the correct side of the slow EMA, ADX is above 25, and price is sitting inside a ±200-point entry zone around the fast EMA. Once that initial ticket is on, EX12060 stacks up to four additional tickets in the same direction, but only if the trend is still strong and every existing ticket on that side has already been "secured" — meaning each ticket is sitting on at least 100 points of unrealized profit and its stop has been ratcheted up to break-even.
The trade engine runs on every tick from OnTick(). First it refreshes the three indicator buffers (3 bars each from iMA and iADX). Then it pulls basket-level profit from CalculateTotalProfit() and compares against the dollar-based BasketTakeProfit ($20) and BasketStopLoss ($8). If either side is hit, CloseAll(POSITION_TYPE_BUY) and CloseAll(POSITION_TYPE_SELL) flatten the entire magic-22212060 book, the function logs the reason, and OnTick returns early so no new entries are placed for that bar. This means basket-level TP/SL always wins — no ticket inside the basket can be left dangling when the dollar threshold is reached.
The signal layer is CheckEntryLogic(). It reads the trend direction (isTrendUp = fast > slow, isTrendDown = fast < slow) and the trend strength (isStrongTrend = ADX > 25). Before evaluating entries, the function performs a critical pre-filter: if the trend just flipped, every ticket on the opposite side is closed. So if price has been falling and the fast EMA crosses back above the slow, the function will instantly close all open sells before it considers opening a new buy. This is the only fast-path flip handling in the EA — there is no separate regime classifier, no multi-timeframe alignment, no "transition" state.
For the initial entry (count=0), the function allows a buy only when ask is within 200 points of the fast EMA in either direction. This is a deliberate "wait for the pullback to the EMA" design: the EA does not chase breakouts; it wants the retest. The mirror rule applies for sells — bid must be within ±200pt of the fast EMA. Once the initial position is on, every subsequent pyramid ticket in the same direction is gated by two conditions checked together: (1) ArePositionsSecure(type) returns true only when every existing same-direction ticket is at least 100 points in profit (so the basket's stop has effectively moved to break-even on each of them via the manage pass), and (2) current price has moved at least 300 points (PyramidStepPoints) beyond the most recent open price in the direction of the trend (GetLastOpenPrice(type) returns the most extreme entry — the highest buy or the lowest sell). If both gates pass, trade.Buy(lot, _Symbol, ask, ask - sl, 0, InpTradeComment) opens ticket #2, #3, #4, #5.
Lot sizing lives in CalculateLot(int existingCount). With UseLotMultiplier = false (the default) every ticket is the same size: 0.01 lots, snapped down to the symbol's lot step and clamped to the broker's min/max. With UseLotMultiplier = true, each successive ticket is multiplied by 1.2^(count) — so #1=0.01, #2=0.012, #3=0.0144, #4=0.01728, #5=0.02074 — yielding a geometrically scaling basket where the average entry is gradually pulled toward the trend but the recent tickets carry more risk. The per-ticket stop is fixed at 300 points below entry for buys, 300 above for sells (InitialSLPoints = 300 × symbol point). That stop is set on the open and is not widened afterwards; the only SL modification happens in the manage pass.
ManagePositions() is where the secure-to-breakeven logic lives. It loops every open position, skips non-magic tickets, and for each one checks whether the price has moved 100 points past the open in the profitable direction. If yes, AND the existing stop is still on the loss side of the open price (or zero for a newly opened position that never had an SL attached — note that opens set ask - sl so SL is always set on entry), it calls TryModify_EX12060(ticket, openPrice, tp) to push the stop to the entry price. The original TP slot remains 0 (no TP), so the trade has no fixed target — it can only exit via basket TP, basket SL, trend-reversal close, or the secured stop. This is a pure "let winners run until the basket prints or the regime breaks" philosophy.
The risk control layer is short. There are no per-trade R-multiple limits, no daily loss caps, no trade-time windows, no spread cap, no slippage cap beyond the 50-point deviation passed to CTrade.SetDeviationInPoints(). The IOC fill mode is set in OnInit (SetTypeFilling(ORDER_FILLING_IOC)) for fast execution. The only hard circuit breakers are: (1) the basket SL at -$8 closes the entire book, (2) the trend-flip close that flushes opposite positions, and (3) the MaxPositions=5 cap on per-direction count. That makes EX12060 sensitive to drawdown depth on the basket level, not on the per-ticket level. A single 300-point move against the highest-entry ticket will not be stopped out — the basket needs to lose $8 net for the emergency close to trigger.
The visual layer paints a small on-chart dashboard in the upper-right corner via CreateDashboard() and UpdateDashboard(). The dashboard shows current basket P/L, trend direction (BULLISH/BEARISH), ADX value with a "(Strong)" or "(Weak)" tag relative to the threshold, and the live count of buy and sell positions. The dashboard text color flips between clrLime (positive P/L) and clrRed (negative P/L). Two small dot markers (yellow for fast EMA, dodger-blue for slow EMA) ride on the right edge of the chart via DrawTrendLines() to show the live indicator values without charting the full lines. Both visuals are gated by ShowDashboard = true and are torn down cleanly in OnDeinit() along with the indicator handles.
EX12060 is a strategy for traders who trust the trend and want to be paid to wait. It does best on M5 charts of liquid FX majors and metals (XAUUSD is the suggested default) where the EMA 20/50 cross fires cleanly and the 14-period ADX picks up directional energy. It does less well on ranging pairs where the trend flips every few bars — every flip costs a basket flush, and five failed pyramids in a row can stack losses that approach the $8 basket stop. Run it on an ECN or low-spread broker; the 50-point deviation tolerance covers most fills, but the IOC mode means a 5-pip-spread broker will be eaten alive on the first pullback entry.
Strategy Deep Dive
On every tick, the three indicator handles (EMA 20, EMA 50, ADX 14) refresh their 3-bar buffers via CopyBuffer. CalculateTotalProfit() sums the dollar P/L of all magic-22212060 positions; if it reaches +$20 or falls to -$8, both CloseAll() calls flatten the entire book and OnTick returns early. Otherwise ManagePositions() walks every open position and ratchets its stop to breakeven once the ticket clears 100 points of profit, routing the modify through the 3-attempt 200ms retry wrapper TryModify_EX12060. CheckEntryLogic() then evaluates the trend: if the fast EMA is on the correct side of the slow EMA and ADX is above 25, it either opens a new ticket inside the ±200pt fast-EMA zone (initial entry) or adds a pyramid ticket at least 300 points beyond the last entry on that side, conditional on ArePositionsSecure() confirming every prior ticket is already 100 points in profit.
EX12060 enters long when EMA(20) is above EMA(50) AND ADX(14) > 25 AND the ask price is within ±200 points of the fast EMA. Pyramid adds (up to MaxPositions=5 per direction) require both that price has extended at least 300 points (PyramidStepPoints) beyond the most recent entry in the trend's direction, AND that every existing same-direction ticket is already sitting on at least 100 points of unrealized profit (the secure threshold).
EX12060 has no per-ticket take-profit. Exits happen only via (1) basket TP when total magic-22212060 P/L reaches $20 (BasketTakeProfit), (2) basket SL when total P/L hits -$8, (3) trend reversal that closes all opposite-direction tickets the moment the fast/slow EMA relationship flips inside CheckEntryLogic(), or (4) the managed break-even stop that fires once each ticket is 100 points in profit via ManagePositions().
Every ticket opens with a fixed 300-point stop (InitialSLPoints × symbol point). ManagePositions() ratchets that stop to the open price once the ticket reaches 100 points of unrealized profit (SecureProfitPoints). Basket-level SL is a separate dollar circuit breaker at -$8 in account currency that flattens the entire magic-22212060 book on the same tick.
No per-ticket TP is set on opens (TP slot is 0). Profit-taking is basket-level only: CalculateTotalProfit() is compared against BasketTakeProfit ($20 default) on every tick, and when the threshold is hit every ticket in both directions is closed via CloseAll() — the basket prints and EX12060 waits for the next EMA cross before re-entering.
EX12060 is best for traders running a $100–$500 micro account on XAUUSD M5 with an ECN or low-spread broker. Recommended lots: keep UseLotMultiplier=false (0.01 fixed) for accounts under $1,000; flip the multiplier to 1.2x only above $1,000 where each pyramid level fits comfortably inside margin. Run it during the London and New York sessions where XAUUSD M5 produces the cleanest EMA 20/50 separations, and pair it with a parent-account daily max-loss rule — the basket SL is only $8, and back-to-back losing pyramids can compound quickly when a trend chops.
Strategy Logic
Pipsgrowth EX12060 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212060
Version: 2.00
BRIEF:
Secure Momentum Pyramid strategy using EMA crossover with ADX strength filter. Pyramids into trends with step-based entries, basket TP/SL management, and position securing via stop-loss to break-even. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CalculateLot()CalculateTotalProfit()CountPositions()GetLastOpenPrice()ArePositionsSecure()CloseAll()ManagePositions()CheckEntryLogic()UpdateDashboard()CreateDashboard()DrawTrendLines()TryClose_EX12060()- ...and 2 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (17 total across 4 groups):
- [=== Risk Management ===]
InitialLot=0.01// Starting Lot Size - [=== Risk Management ===]
LotMultiplier=1.2// Lot Multiplier for Pyramid - [=== Risk Management ===]
UseLotMultiplier=false// Enable LotMultiplier(false= Fixed Lot) - [=== Risk Management ===]
MaxPositions= 5 // Maximum Number of Pyramid Levels - [=== Risk Management ===]
InitialSLPoints= 300 // Initial StopLoss(Points) - [=== Risk Management ===]
BasketTakeProfit=20.0// Target Profit to Close All ($) - [=== Risk Management ===]
BasketStopLoss=8.0// Emergency StopLoss($) - [=== Risk Management ===]
SecureProfitPoints= 100 // Profit Required to SecurePosition(Points) - [=== Strategy Settings ===] EMA_Fast = 20 // Fast
EMA - [=== Strategy Settings ===] EMA_Slow = 50 // Slow
EMA - [=== Strategy Settings ===] ADX_Period = 14 //
ADXPeriod - [=== Strategy Settings ===] ADX_Threshold = 25 //
ADXStrength - [=== Strategy Settings ===]
PyramidStepPoints= 300 // Points to move before adding position - [=== Strategy Settings ===]
EntryZonePoints= 200 // Entry Zone Width around FastEMA(Points) - [=== Identity ===]
MagicNumber=22212060// Magic number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12060" // Trade comment - [=== Visuals ===]
ShowDashboard=true// --- Global Variables ---
// Pipsgrowth EX12060 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Secure Momentum Pyramid strategy using EMA crossover with ADX strength filter. Pyramids into trends with step-based entries, basket TP/SL management, and position securing via stop-loss to break-even. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
ON_INIT:
Create indicator handles: standard set
Initialize state variables
Detect broker GMT offset
ON_TICK:
1. Refresh indicator buffers (closed-bar shift=1)
2. Manage existing positions:
- Break-even check
- ATR trailing stop
- Profit lock ratchet
- Time-based exit
- Opposite-signal exit
3. If new bar:
a. ClassifyRegime() — ADX/ATR/BB regime detection
b. NoTradeGate() checks:
- Market open + session filter
- Spread limit
- Cooldown after loss
- Consecutive loss limit
- Kill switch
- Max drawdown
- Max concurrent positions
- Daily/weekly loss limits
c. GenerateSignal() — strategy-specific entry logic
d. CheckConfirm() — HTF alignment + R:R + ADX minimum
e. Calculate position size from risk %
f. Execute with retry logic
g. Mark bar to prevent duplicates
ON_TESTER:
Custom fitness = weighted(RecoveryFactor, ROI, ProfitFactor, TradeCount, Sharpe, Drawdown)Optimization Profile
How to Install This EA on MT5
- 1Download the .mq5 file using the button above
- 2Open MetaTrader 5 on your computer
- 3Click File → Open Data Folder in the top menu
- 4Navigate to MQL5 → Experts and paste the .mq5 file there
- 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
- 6Drag the EA onto a chart matching the recommended timeframe
- 7Configure parameters according to the table on this page
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InitialLot | 0.01 | Starting Lot Size |
| LotMultiplier | 1.2 | Lot Multiplier for Pyramid |
| UseLotMultiplier | false | Enable Lot Multiplier (false = Fixed Lot) |
| MaxPositions | 5 | Maximum Number of Pyramid Levels |
| InitialSLPoints | 300 | Initial Stop Loss (Points) |
| BasketTakeProfit | 20.0 | Target Profit to Close All ($) |
| BasketStopLoss | 8.0 | Emergency Stop Loss ($) |
| SecureProfitPoints | 100 | Profit Required to Secure Position (Points) |
| EMA_Fast | 20 | Fast EMA |
| EMA_Slow | 50 | Slow EMA |
| ADX_Period | 14 | ADX Period |
| ADX_Threshold | 25 | ADX Strength |
| PyramidStepPoints | 300 | Points to move before adding position |
| EntryZonePoints | 200 | Entry Zone Width around Fast EMA (Points) |
| MagicNumber | 22212060 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12060" | Trade comment |
| ShowDashboard | true | --- Global Variables --- |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12060 G4_7 — Secure Momentum Pyramid with EMA+ADX, full 12-layer stack."
#include <Trade\Trade.mqh>
//--- Input Parameters ---
input group "=== Risk Management ==="
input double InitialLot = 0.01; // Starting Lot Size
input double LotMultiplier = 1.2; // Lot Multiplier for Pyramid
input bool UseLotMultiplier = false; // Enable Lot Multiplier (false = Fixed Lot)
input int MaxPositions = 5; // Maximum Number of Pyramid Levels
input double InitialSLPoints = 300; // Initial Stop Loss (Points)
input double BasketTakeProfit = 20.0; // Target Profit to Close All ($)
input double BasketStopLoss = 8.0; // Emergency Stop Loss ($)
input double SecureProfitPoints = 100; // Profit Required to Secure Position (Points)
input group "=== Strategy Settings ==="
input int EMA_Fast = 20; // Fast EMA
input int EMA_Slow = 50; // Slow EMA
input int ADX_Period = 14; // ADX Period
input int ADX_Threshold = 25; // ADX Strength
input int PyramidStepPoints = 300; // Points to move before adding position
input int EntryZonePoints = 200; // Entry Zone Width around Fast EMA (Points)
input group "=== Identity ==="
input int MagicNumber = 22212060; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_12060"; // Trade comment
input group "=== Visuals ==="
input color BullishColor = clrLime;
input color BearishColor = clrRed;
input bool ShowDashboard = true;
//--- Global Variables ---
CTrade trade;
int handle_ema_fast;
int handle_ema_slow;
int handle_adx;
double EMA_Fast_Buffer[];
double EMA_Slow_Buffer[];
double ADX_Buffer[];
//+------------------------------------------------------------------+
//| Helper Functions (Declared First to fix errors) |
//+------------------------------------------------------------------+
double CalculateLot(int existingCount);
double CalculateTotalProfit();
int CountPositions(ENUM_POSITION_TYPE type);
double GetLastOpenPrice(ENUM_POSITION_TYPE type);
bool ArePositionsSecure(ENUM_POSITION_TYPE type);
void CloseAll(ENUM_POSITION_TYPE type);
void ManagePositions();
void CheckEntryLogic(double currentTotalProfit);
void UpdateDashboard(double profit, double adx, double emaF, double emaS);
void CreateDashboard();
void DrawTrendLines();
Full source code available on download
Educational purposes only. Do NOT use with real money. Test on demo accounts only.
Clear Warning: Educational Purposes Only
Clear Warning: This Expert Advisor is for educational and testing purposes only. Do NOT use it with real money. Test only on demo accounts. Trading with real money involves substantial risk of capital loss. This does not constitute investment advice.
Recommended Brokers for This EA
These EAs run on MT5 — use a regulated broker with fast execution and tight spreads
Markets.com
Exness
IC Markets
Similar Expert Advisors
View All Expert AdvisorsMore Other strategy EAs from our library
Pipsgrowth EX01007 Adaptive
Pipsgrowth.com EX01007 Adaptive XAUUSD 5M — multi-indicator signal scorer with regime filter, full 12-layer stack, configurable timeframe, trailing/BE/profit-lock toggles, pyramid gate, spread filter, new-bar gate, filling mode detection.
Pipsgrowth EX01019 Adaptive
Pipsgrowth.com EX01019 Self-Adaptive Market EA Fixed — multi-regime adaptive EA, full 12-layer stack.
Pipsgrowth EX15029 SMC-OrderBlock
Pipsgrowth.com EX15029 SMCBreakoutEA — SMC breakout CHOCH/liquidity sweep EA, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.