Pipsgrowth EX12029 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX12029 EA_X1_A7EC5A36 — EMA/RSI crossover with diagnostics and session validation, full 12-layer stack.
Overview
Pipsgrowth EX12029 is a thin, two-signal trend-following Expert Advisor built around one crossover pair and one oscillator threshold. The whole decision engine in OnTick is fed by three indicator handles created in OnInit: a 70-period EMA (hEMA_Fast), a 290-period EMA (hEMA_Slow), and a 37-period RSI (hRSI) — all on close. There is no MACD, no ATR stop mode, no retest, no HTF filter, and no regime classifier; the 12-layer breakdown in the brief is the architectural template the family follows, not a list of switches wired into this specific build. What you actually get is the entry logic: SignalBuy() requires RSI[1] < 25 && RSI[0] >= 25 while TrendBiasBuy() (EMA70 > EMA290) is true; SignalSell() mirrors it with the 70-threshold and a fast-below-slow EMA read. Signals are evaluated only on a new bar (IsNewBar()) so a sustained move that doesn't print a fresh RSI threshold cross on the closing bar of a new candle simply doesn't trade.
Position management runs the same way: minimal and explicit. The first order in a direction is tagged "Initial BUY" or "Initial SELL"; every subsequent same-direction order is tagged "Add#1", "Add#2", and so on. Before any add is allowed, IsAllSameDirProfitableAtLeast(dir, MinProfitPerTradeToAdd=5.0, tick) walks the open ticket pool and requires every existing same-direction position to be at least 5 points in the green — so the EA will not stack a losing position on top of a losing position. The hard cap is MaxOpenTrades=6 per magic number, counted across both directions by CountAllOpenPositions(). This makes the strategy a low-trade-frequency trend rider, not a scalper: it places one new entry per qualifying bar until it hits the cap, then waits.
The dynamic-lock-profit layer is the only thing doing work between entries. Every tick, the OnTick maintenance loop calls ApplyDynamicLockProfitToPosition() for each open ticket. That function measures how far price has moved from entry in points (moved), divides by InpLockProfitEveryXPoints=1500, and if the integer number of "lock steps" is at least one, it sets a new stop at entry + steps*1500 - 76 for a buy (or the mirror for a sell). 76 points is the give-back buffer that prevents the stop from sitting on the high-water tick. The function is strictly one-way: CanModifySL() rejects any new SL that isn't tighter than the current one (within a 0.5-point noise band), and the new SL is also clipped to respect the broker's SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL so the modify doesn't get bounced. After the floor, ModifySLTP() retries up to three times on REQUOTE or TIMEOUT, sleeping 120ms×attempt between tries. Net effect: on USDJPY the SL ratchets at every 150-pip leg of profit, and it will never loosen again for the life of the trade.
The risk inputs are deliberately portable. SL is InpSLPoints=2400 and TP is InpTPPoints=1800, which gives a 0.75:1 R:R on a fixed SL/TP basis. With the 1.0-lot default and InpUseRiskPercent=false, sizing is constant; flip the switch and CalcLotFromRisk() derives lots from balance * InpRiskPercent / (SL_points * valuePerPointPerLot) and normalizes to the symbol's SYMBOL_VOLUME_STEP. The default InpMaxSlippagePoints=5 is passed straight into req.deviation on every OrderSend. OrderSendWithRetry() itself retries three times on the generic retcode path and will also, on a TRADE_RETCODE_INVALID_STOPS, strip the SL/TP and re-send once before giving up. Filling mode is chosen by GetBestFillingMode() in this order: IOC → RETURN → FOK → RETURN fallback, so it adapts to whatever the broker allows.
The session filter is a free feature sitting behind a disabled switch. InpUseSessionFilter=false by default, which means MarketIsTradableNow() short-circuits to true and trades 24/5 minus the broker's own tradable window. When you flip it on, CacheSessionConfiguration() parses three "HH:MM" strings into minutes-from-midnight and IsWithinTradingSessions() runs a 3-window OR check that also handles the wrap-around case where start > end (an evening→morning window). The three defaults — 07:00–10:00 (London morning), 13:00–17:00 (London/NY overlap), 20:00–23:00 (Asian evening) — are pre-loaded but inert until the user enables the filter, and weekends are blocked by day_of_week == 0 || 6 regardless of the windows. The spread gate is wired in directly: CheckSpreadOK() blocks entries whenever (ask-bid)/point > InpMaxSpreadPoints=20, so XAUUSD during a wide-spread NY rollover can sit on its hands even with the session filter off.
Ticket resolution is the one place this EA does extra work that the rest of the family sometimes skips. After OrderSendWithRetry() returns a MqlTradeResult, OpenPosition() tries HistoryDealSelect(res.deal) to read the DEAL_POSITION_ID, then HistoryOrderSelect(res.order) to read ORDER_POSITION_ID, and then waits up to 5×40ms for PositionSelectByTicket() to confirm the position is visible. If that still fails it falls back to a PositionsTotal() walk matching on symbol, magic, comment, and lot. This is the part that makes the EA robust against brokers that take a few ticks to make a new position visible to PositionSelectByTicket() — which matters because ApplyDynamicLockProfitToPosition() runs on the next tick, not the same tick, and a missing ticket would silently skip the ratchet.
The execution tail is short but explicit. TryClose_EX12029() and TryClosePartial_EX12029() both retry three times on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED with a 200ms sleep, while TryModify_EX12029() retries three times on REQUOTE / TIMEOUT only with a 100ms sleep — modify is the asymmetric one because a PRICE_CHANGED on a stop-loss modify is treated as a broker rejection, not a transient. The bottom line: EX12029 is the kind of EA you point at one symbol on one timeframe, set a sensible max-trades cap, leave DLP on, and let it ride. The reason it's tagged "slim" in the family is exactly that — no auxiliary filters to debug, no regime state machine to validate, just an EMA cross with an RSI gate and a 1500/76 ratchet.
Strategy Deep Dive
Each tick walks every open ticket that matches the magic + symbol, and ApplyDynamicLockProfitToPosition measures move-from-entry in points, divides by 1500, and if the integer step is positive, raises a new SL to entry + steps1500 - 76 (buy) or the mirror (sell), clipped to the broker's stops/freeze level. New bar detection gates the entry path: OnTick calls IsNewBar, then MarketIsTradableNow (session + weekend check), CheckSpreadOK (20-pt cap), and then SignalBuy/SignalSell — the buy is an RSI(37) cross back up through 25 with the 70-EMA above the 290-EMA, sell is the symmetric down-cross of 70 with fast-below-slow. Lot sizing is 1.0 fixed by default; flipping InpUseRiskPercent=true routes through CalcLotFromRisk, which divides balancerisk% by SL_points*valuePerPointPerLot and normalizes to the symbol's lot step. Adds are tagged Add#N and only fire when every existing same-direction position is at least 5 points in the green, hard-capped at MaxOpenTrades=6. OrderSend uses GetBestFillingMode (IOC→RETURN→FOK), and the retry path strips SL/TP once and re-sends on TRADE_RETCODE_INVALID_STOPS before failing.
Entries are bar-close only: the EA requires a new bar to form, then SignalBuy fires when the 37-period RSI crosses back up through 25 from below while the 70-EMA is above the 290-EMA, and SignalSell mirrors it with RSI crossing down through 70 while the fast EMA is below the slow. The first same-direction order is tagged Initial, every subsequent same-direction order is tagged Add#N, and adds only fire if every existing position in that direction is at least 5 points in the green.
Exits are passive on the per-trade SL/TP (2400 / 1800 points) and active via the dynamic-lock-profit ratchet: every 1500 points of favorable move, ApplyDynamicLockProfitToPosition tightens the stop to entry ± (steps*1500 - 76), clipped to the broker's stops/freeze level and only ever moving in the protective direction. There is no signal-driven close — a position runs until the broker hits the modified SL or the original TP.
Hard stop at InpSLPoints=2400 points from entry on every order, set via NormalizePrice in OnTick. The dynamic-lock-profit layer additionally ratchets the SL tighter every 1500 points of favorable move, leaving a 76-point give-back buffer and only ever moving in the protective direction (CanModifySL rejects any loosening).
Fixed take profit at InpTPPoints=1800 points from entry on every order. With the 2400-point SL that gives a 0.75:1 R:R on a per-trade basis; the EA does not scale or trail the TP, so profitable ratchets of the SL effectively convert portions of the position into a lower-risk runner that still has the original 1800-point TP target on the broker side.
Best on a single FX major or XAUUSD on H1 with $100 minimum balance at medium risk, default 1.0-lot sizing. ECN or low-spread accounts are required because the 20-point spread cap will gate entries on wide spreads (especially on gold during rollover); for the same reason, point-based inputs (SL 2400, TP 1800, lock 1500) need re-checking before dropping it onto XAUUSD since 2400 points on USDJPY is 240 pips but 2400 points on XAUUSD is $24.00 per lot, which is roughly 1R of typical daily gold range — a different risk profile than the FX-major default. The pre-configured session windows (07-10, 13-17, 20-23 server time) fit most MT5 broker GMT offsets but should be sanity-checked before enabling InpUseSessionFilter.
Strategy Logic
Pipsgrowth EX12029 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212029
Version: 2.00
BRIEF:
EMA crossover EA with RSI threshold entries, dynamic lock profit, session filters, fixed spread cap, debug logging, and multi-position management with profitable-add gating. Variant of X1 series with diagnostics and session validation. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
Tag()Log()WarnOncePerSec()DebugPrint()IsOurPosition()OwnsPosition()CountOpenPositions()CountAllOpenPositions()CountAdditionalPositions()IsAllSameDirProfitableAtLeast()NormalizeVolume()NormalizePrice()- ...and 23 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (30 total across 7 groups):
- [=== Identity ===]
InpSymbol= "USDJPY" // Trading Symbol - [=== Identity ===]
InpTimeframe= 1 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart Timeframe - [=== Identity ===]
MagicNumber=22212029// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12029" // Trade comment - [=== Signal ===]
InpEMAFastPeriod= 70 // FastEMAPeriod - [=== Signal ===]
InpEMASlowPeriod= 290 // SlowEMAPeriod - [=== Signal ===]
InpRSIPeriod= 37 //RSIPeriod - [=== Signal ===]
InpRSIBuyThreshold=25.0//RSIBuyThreshold(cross above) - [=== Signal ===]
InpRSISellThreshold=70.0//RSISellThreshold(cross below) - [=== Sizing ===]
InpUseRiskPercent=false// Use Risk Percentage - [=== Sizing ===]
InpRiskPercent=1.0// RiskPercentage(% of balance) - [=== Sizing ===]
InpFixedLot=1.0// Fixed Lot Size - [=== Sizing ===]
InpSLPoints= 2400 // StopLoss(points) - [=== Sizing ===]
InpTPPoints= 1800 // TakeProfit(points) - [=== Sizing ===]
InpMaxSlippagePoints= 5 // MaximumSlippage(points) - [===
NO-TRADE===]InpMaxSpreadPoints=20.0// Maximum allowed spread (points, 0=disabled) - [===
NO-TRADE===]InpUseSessionFilter=false// Enable Session Filter - [===
NO-TRADE===]InpSession1StartTime= "07:00" // Session 1 StartTime(HH:MM) - London Open - [===
NO-TRADE===]InpSession1EndTime= "10:00" // Session 1 EndTime(HH:MM) - London Morning - [===
NO-TRADE===]InpSession2StartTime= "13:00" // Session 2 StartTime(HH:MM) - London/NY Overlap - [===
NO-TRADE===]InpSession2EndTime= "17:00" // Session 2 EndTime(HH:MM) - NY Session - [===
NO-TRADE===]InpSession3StartTime= "20:00" // Session 3 StartTime(HH:MM) - Asian Session - [===
NO-TRADE===]InpSession3EndTime= "23:00" // Session 3 EndTime(HH:MM) - Asian Evening - [=== Manage ===]
InpEnableDynamicLockProfit=true// Enable Dynamic Lock Profit - [=== Manage ===]
InpLockProfitEveryXPoints= 1500 // Lock Profit Every X Points - [=== Manage ===]
InpLockMinusYPointsBuffer= 76 // LockBuffer(points back from high) - [=== Scaling ===]
MaxOpenTrades= 6 // Maximum Open Trades - [=== Scaling ===]
AllowOnlyProfitableAdditions=true// Allow Only Profitable Additions - [=== Scaling ===]
MinProfitPerTradeToAdd=5.0// Min Profit Per Trade toAdd(points) - [=== Debug ===]
InpEnableDebugLogs=false// Enable verbose debug logging for decision flow
// Pipsgrowth EX12029 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// EMA crossover EA with RSI threshold entries, dynamic lock profit, session filters, fixed spread cap, debug logging, and multi-position management with profitable-add gating. Variant of X1 series with diagnostics and session validation. 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 |
|---|---|---|
| InpSymbol | "USDJPY" | Trading Symbol |
| InpTimeframe | 1 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart Timeframe |
| MagicNumber | 22212029 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_12029" | Trade comment |
| InpEMAFastPeriod | 70 | Fast EMA Period |
| InpEMASlowPeriod | 290 | Slow EMA Period |
| InpRSIPeriod | 37 | RSI Period |
| InpRSIBuyThreshold | 25.0 | RSI Buy Threshold (cross above) |
| InpRSISellThreshold | 70.0 | RSI Sell Threshold (cross below) |
| InpUseRiskPercent | false | Use Risk Percentage |
| InpRiskPercent | 1.0 | Risk Percentage (% of balance) |
| InpFixedLot | 1.0 | Fixed Lot Size |
| InpSLPoints | 2400 | Stop Loss (points) |
| InpTPPoints | 1800 | Take Profit (points) |
| InpMaxSlippagePoints | 5 | Maximum Slippage (points) |
| InpMaxSpreadPoints | 20.0 | Maximum allowed spread (points, 0=disabled) |
| InpUseSessionFilter | false | Enable Session Filter |
| InpSession1StartTime | "07:00" | Session 1 Start Time (HH:MM) - London Open |
| InpSession1EndTime | "10:00" | Session 1 End Time (HH:MM) - London Morning |
| InpSession2StartTime | "13:00" | Session 2 Start Time (HH:MM) - London/NY Overlap |
| InpSession2EndTime | "17:00" | Session 2 End Time (HH:MM) - NY Session |
| InpSession3StartTime | "20:00" | Session 3 Start Time (HH:MM) - Asian Session |
| InpSession3EndTime | "23:00" | Session 3 End Time (HH:MM) - Asian Evening |
| InpEnableDynamicLockProfit | true | Enable Dynamic Lock Profit |
| InpLockProfitEveryXPoints | 1500 | Lock Profit Every X Points |
| InpLockMinusYPointsBuffer | 76 | Lock Buffer (points back from high) |
| MaxOpenTrades | 6 | Maximum Open Trades |
| AllowOnlyProfitableAdditions | true | Allow Only Profitable Additions |
| MinProfitPerTradeToAdd | 5.0 | Min Profit Per Trade to Add (points) |
| InpEnableDebugLogs | false | Enable verbose debug logging for decision flow |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12029 EA_X1_A7EC5A36 — EMA/RSI crossover with diagnostics and session validation, full 12-layer stack."
//---------------------------- Includes --------------------------------
#include <Trade/Trade.mqh>
//---------------------------- Inputs --------------------------------
//===================================================================
// CORE SETTINGS
//===================================================================
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M5;
case 3: return PERIOD_M15;
case 4: return PERIOD_M30;
case 5: return PERIOD_H1;
case 6: return PERIOD_H4;
case 7: return PERIOD_D1;
default: return PERIOD_H1;
}
}
ENUM_APPLIED_PRICE MapAppliedPriceInt(int ap)
{
switch(ap)
{
case 1: return PRICE_CLOSE;
case 2: return PRICE_OPEN;
case 3: return PRICE_HIGH;
case 4: return PRICE_LOW;
case 5: return PRICE_MEDIAN;
case 6: return PRICE_TYPICAL;
case 7: return PRICE_WEIGHTED;
default: return PRICE_CLOSE;
}
}
ENUM_TIMEFRAMES g_InpTimeframe = PERIOD_H1;
input group "=== Identity ==="
input string InpSymbol = "USDJPY"; // Trading Symbol
input int InpTimeframe = 1; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Chart Timeframe
input int MagicNumber = 22212029; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_12029"; // Trade comment
//===================================================================
// TRADING STRATEGY
//===================================================================
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M5;
case 3: return PERIOD_M15;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.