Pipsgrowth EX12034 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX12034 Libre_XAUUSD_5M — CCI + EMA trend-filter confluence, full 12-layer stack.
Overview
Pipsgrowth EX12034 is a deliberately compact two-indicator trend-pullback EA. The entire decision tree is two lines of indicator math and two lines of gating: read CCI(14) and EMA(100) on the chart timeframe at bar [1], and place a buy when the closed bar's CCI is above +100 and its close is above the EMA; place a sell as the mirror. That is the whole signal. There is no second timeframe, no additional oscillator, no volume filter, no session filter, and no regime classifier. The EA enters exactly one position at a time, holds until the 400-point stop or the 600-point target is hit, and then waits for the next valid bar to re-evaluate.
The source is correspondingly thin. Seven functions and ten inputs describe the entire system. OnInit creates two indicator handles — iCCI(_Symbol, _Period, 14, PRICE_CLOSE) and iMA(_Symbol, _Period, 100, 0, MODE_EMA, PRICE_CLOSE) — and configures the CTrade object with the per-EA magic number 22212034, a 3-point deviation, and ORDER_FILLING_FOK. OnTick is the only runtime path: refresh the symbol quote, return immediately if the live spread exceeds InpMaxSpread=250 points, and use a static datetime lastBar to gate every code path to the first tick of a new bar. Anything that arrives on an in-bar tick is ignored. The single downstream function is CheckSignal(), which calls CopyBuffer on the two handles, computes the closed-bar close, and arms the buy or sell flag.
Position management is the most minimalist in the EX12 family. There is no scaling, no pyramid, no breakeven ratchet, no ATR trail, and no time-based exit. OpenBuy anchors the stop at mysymbol.Ask() minus 400 points and the target at ask + 600 points, then fires CTrade.Buy() with the lot returned from CalculateLotSize and the InpTradeComment string. OpenSell is the mirror at bid. The risk lot is computed as account.Balance() * 1.0% divided by the per-lot loss at 400 points, then floored to the broker's LotStep, clamped to LotsMin / LotsMax, and only used when InpRiskPercent is positive; if risk is set to zero (or the symbol has no TickSize / Point), the EA falls back to InpFixedLot=0.01. The MathFloor is a deliberate design choice — it guarantees the lot is never over-sized relative to the requested risk.
The retry wrappers expose the same asymmetric pattern used across the rest of the EX12 family. TryClose_EX12034 and TryClosePartial_EX12034 both loop three times on a 200-millisecond sleep and accept the four transient retcodes (TRADE_RETCODE_REQUOTE, TRADE_RETCODE_TIMEOUT, TRADE_RETCODE_PRICE_OFF, TRADE_RETCODE_PRICE_CHANGED) — any of these means the close simply hasn't happened yet, so the loop retries. TryModify_EX12034 also loops three times but only on REQUOTE and TIMEOUT, and sleeps 100 ms instead of 200. PRICE_OFF and PRICE_CHANGED are deliberately treated as hard failures for modify operations because a stop or target move that the broker is rebidding on is not the same kind of transient as a requote; the EA does not want to silently re-issue a new SL/TP at a different price than the strategy intended. None of the three retry helpers is wired to a per-position management function in the file, however — they exist as drop-in plumbing for any future version that adds trailing, breakeven, or opposite-signal exits.
The header claims a 12-layer architecture (REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester), but the file as written only wires four of them. SIGNAL and ENTRY are the CCI/EMA confluence; RISK and SIZING are the percent-based lot. CONFIRM, NO-TRADE, CAPITAL CAP, MANAGE, EXIT, SCALING, and OnTester are not implemented — there is no DetectGMT, no session window, no ClassifyRegime, no profit-lock routine, no pyramid cap, and no OnTester fitness formula. The spread filter acts as the only pre-trade gate, and the fixed SL/TP act as the only exit. This is intentional: EX12034 is a transparent base that can be audited in a single read of CheckSignal and OpenBuy.
Trading expectations are direct. With a 1:1.5 R:R the strategy needs a win rate above 40% to be net positive before spread and commission, which is reasonable for a CCI level-cross with a 100-bar trend filter on a trending symbol like XAUUSD. The MathFloor lot step also slightly under-sizes the position versus a MathRound implementation, which leans risk to the conservative side on every trade and partially insulates the equity curve from a sudden spread widening on the entry fill. The default config on XAUUSD M5 sees the EA sit out consolidation because the EMA(100) is far enough away that closes below the line force sells and closes above the line force buys, while the CCI > ±100 requirement keeps the EA out of the noise around the zero line. Drawdowns arrive when a 400-point stop is hit three or four times in a row during a ranging regime — there is no daily-loss cap or consecutive-loss cooldown in the code, so account equity is the only governor. A trader who wants to add those should layer them in via the MQL5 strategy tester before deploying on a live account.
Strategy Deep Dive
OnInit spins up two indicator handles — iCCI(14) and iMA(100, MODE_EMA) on PRICE_CLOSE — and arms CTrade with magic 22212034, 3-point deviation, and ORDER_FILLING_FOK. OnTick refreshes the symbol quote, bails when spread > InpMaxSpread=250 points, and uses a static lastBar to gate the entire pipeline to the first tick of a new chart bar. CheckSignal then calls CopyBuffer on the two handles, reads the close of bar [1], and arms a buy when CCI[1] > +100 and close[1] > EMA[1], or a sell when CCI[1] < -100 and close[1] < EMA[1]; the single-positions-total gate blocks both. CalculateLotSize computes lot = (balance * InpRiskPercent%) / riskPerLot at 400 points, floors to LotStep, clamps to LotsMin / LotsMax, and falls back to InpFixedLot=0.01 when risk sizing is disabled or the symbol lacks TickSize / Point. OpenBuy and OpenSell attach a 400-point SL and 600-point TP directly to the order, then the three retry helpers (TryClose_EX12034, TryClosePartial_EX12034, TryModify_EX12034) sit on standby — defined at file scope but not invoked from the running tick path in this build.
A long entry fires on the first tick of a new bar when the closed bar's CCI(14) reads above +100 and the closed bar's close trades above the EMA(100) — confirmed only on bar [1], never on the building bar. A short is the mirror: CCI(14) below -100 and close below EMA(100). The check runs only when no position is open and the live spread is under InpMaxSpread=250 points; if either gate fails, the EA waits for the next bar.
Exits are mechanical and entirely server-side. A buy exits at ask + 600 points (TP) or ask - 400 points (SL); a sell exits at bid - 600 points or bid + 400 points. There is no trailing stop, no breakeven ratchet, no time-based exit, and no opposite-signal close in the code — the CTrade.Buy / CTrade.Sell sends the SL and TP at order entry and they remain in place until filled.
Per-trade fixed stop of 400 points (InpStopLoss) attached at entry as part of the CTrade.Buy / CTrade.Sell call. The stop is never moved once placed — no trailing, no breakeven shift, no opposite-signal override. The retry wrapper TryModify_EX12034 is defined for future versions that add stop management.
Per-trade fixed target of 600 points (InpTakeProfit) attached at entry. Combined with the 400-point stop the implied R:R is 1:1.5, requiring roughly a 40% win rate to be net positive before spread and commission. There is no partial close, no scaled-out exit, and no profit-lock trail.
EX12034 is a base-config trend-pullback engine for traders who want a one-position-at-a-time, no-scaling, no-trailing system that is auditable from a single read of the source — minimum recommended balance is $100 at the 0.01 fixed-lot fallback, scaling to roughly 0.4 lot on a $10,000 balance at the default 1% risk with 400-point XAUUSD stops. It is optimized for XAUUSD M5 with the 100-bar EMA and 14-bar CCI defaults, but the math is symbol-agnostic so it will run on any liquid pair. Run it on a low-spread ECN or RAW broker (Exness, IC Markets) because the 400-point stop is consumed by spread on wider accounts, and backtest the 1:1.5 R:R honestly: a win rate under 40% will be net negative before commission.
Strategy Logic
Pipsgrowth EX12034 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212034
Version: 2.00
BRIEF:
CCI + EMA trend-filter confluence EA. Buys when CCI > 100 and price above EMA; sells when CCI < -100 and price below EMA. Risk-based lot sizing with fixed-lot fallback, spread filter, one position at a time. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CheckSignal()OpenBuy()OpenSell()CalculateLotSize()TryClose_EX12034()TryClosePartial_EX12034()TryModify_EX12034()
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (10 total across 3 groups):
- [=== Strategy Parameters ===]
InpCCIPeriod= 14 //CCIPeriod - [=== Strategy Parameters ===]
InpTrendMA= 100 // Trend MA - [=== Money Management ===]
InpRiskPercent=1.0// Risk Percent per Trade - [=== Money Management ===]
InpFixedLot=0.01// FixedLot(if Risk=0) - [=== Money Management ===]
InpStopLoss= 400 // StopLoss(points) - [=== Money Management ===]
InpTakeProfit= 600 // TakeProfit(points) - [=== Trade Management ===]
InpMagicNumber=22212034// Magic Number - [=== Trade Management ===]
InpTradeComment= "Psgrowth.com Expert_12034" // TradeComment - [=== Trade Management ===]
InpMaxSpread= 250 // MaxSpread(points) - [=== Trade Management ===]
InpSlippage= 3 // Slippage
// Pipsgrowth EX12034 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// CCI + EMA trend-filter confluence EA. Buys when CCI > 100 and price above EMA; sells when CCI < -100 and price below EMA. Risk-based lot sizing with fixed-lot fallback, spread filter, one position at a time. 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 |
|---|---|---|
| InpCCIPeriod | 14 | CCI Period |
| InpTrendMA | 100 | Trend MA |
| InpRiskPercent | 1.0 | Risk Percent per Trade |
| InpFixedLot | 0.01 | Fixed Lot (if Risk=0) |
| InpStopLoss | 400 | Stop Loss (points) |
| InpTakeProfit | 600 | Take Profit (points) |
| InpMagicNumber | 22212034 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_12034" | Trade Comment |
| InpMaxSpread | 250 | Max Spread (points) |
| InpSlippage | 3 | Slippage |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12034 Libre_XAUUSD_5M — CCI + EMA trend-filter confluence, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
CTrade trade;
CPositionInfo position;
CSymbolInfo mysymbol;
CAccountInfo account;
//--- Input Groups
input group "=== Strategy Parameters ==="
input int InpCCIPeriod = 14; // CCI Period
input int InpTrendMA = 100; // Trend MA
input group "=== Money Management ==="
input double InpRiskPercent = 1.0; // Risk Percent per Trade
input double InpFixedLot = 0.01; // Fixed Lot (if Risk=0)
input int InpStopLoss = 400; // Stop Loss (points)
input int InpTakeProfit = 600; // Take Profit (points)
input group "=== Trade Management ==="
input int InpMagicNumber = 22212034; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_12034"; // Trade Comment
input int InpMaxSpread = 250; // Max Spread (points)
input int InpSlippage = 3; // Slippage
//--- Handles
int hCCI;
int hMA;
//--- Global Buffers
double bufCCI[];
double bufMA[];
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
trade.SetExpertMagicNumber(InpMagicNumber);
trade.SetDeviationInPoints(InpSlippage);
trade.SetTypeFilling(ORDER_FILLING_FOK);
hCCI = iCCI(_Symbol, _Period, InpCCIPeriod, PRICE_CLOSE);
hMA = iMA(_Symbol, _Period, InpTrendMA, 0, MODE_EMA, PRICE_CLOSE);
if(hCCI == INVALID_HANDLE || hMA == INVALID_HANDLE)
return(INIT_FAILED);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
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.