Pipsgrowth EX12006 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · USDJPY · M5
Pipsgrowth.com EX12006 USDJPY MTF Matrix — H1 SuperTrend + M15 Hull + M5 EMA cross, full 12-layer stack.
Overview
Pipsgrowth EX12006 enforces a strict three-of-three multi-timeframe matrix on USDJPY M5 before any order is sent. Three independent votes, drawn from three different timeframes and three different indicator families, must all point the same direction in the same closed bar. The first vote is a SuperTrend flip on the H1 trend timeframe (configurable via InpTF_Trend, default 8 in the source which maps to PERIOD_H1 in the MapTimeframeInt switch) with period 10 and multiplier 3.0, recomputed in MQL5 for the most recent 200 closed bars inside the SuperTrendDir function. The second vote is a Hull Moving Average slope on the momentum timeframe (InpTF_Mom default 6 in source, which the MapTimeframeInt switch maps to PERIOD_H4 — the in-source comment however calls this the M15 momentum TF, so most operators set it to 3 for PERIOD_M15), built directly from WMA primitives in the HMAat and WMAat helpers. The third vote is a 9/21 EMA cross on the M5 signal timeframe, evaluated on the just-closed bar inside CoreSignal. Only when all three votes register +1 (or all three register -1) does the EA emit a directional signal; anything less returns zero with confidence below 100%.
That 3-of-3 AND gate is the architectural center of EX12006 and the reason the EA fires far less often than typical M5 trend strategies. The matrix is paired with a seven-state regime classifier (DetectRegime) that reads ADX(14), ATR(14), and Bollinger Bands(20, 2.0) on the M5 chart. ADX at or above 30 returns REG_STRONG_TREND; ADX at or above the configurable InpADXMin (default 20) returns REG_WEAK_TREND; an ATR-percentile above 70 with concurrent Bollinger Band-width expansion above 1.15× returns REG_EXPAND; ATR-percentile below 25 returns REG_COMPRESS; a tight BB (band-width over band-mid below 0.0015) with rising ADX returns REG_BREAKOUT; everything else falls through to REG_RANGE. A failure to copy any of the seven buffers returns REG_CHOPPY, which the no-trade gate treats as a hard block.
ConfirmEntry then requires the H1 EMA(InpHTFEMA = 50) to agree with the direction on the closed bar — a long only fires if the last M5 close sits above the H1 EMA(50), a short only if it sits below. The spread filter caps entries at InpMaxSpreadPts = 35 points (USDJPY-tuned, roughly 3.5 pips on a 3-digit quote feed), and the session window is 6:00 to 22:00 server time hardcoded via SESSION_START_HOUR and SESSION_END_HOUR.
NoTradeBlock layers in further gates: the InpKillSwitch toggle, abnormal spread, low-liquidity session, CHOPPY regime, a one-shot news/big-candle block (closed-bar range above 3×ATR(14) via BIG_CANDLE_ATR_MULT = 3.0), a 3-bar cooldown after three consecutive losing trades, a hard capital floor at InpCapitalCapFloor = $50, a daily loss limit at 3% of effective capital, a single-position cap (MAX_OPEN_TRADES = 1), and weekend-proximity shutdowns for Friday after 21:00 and all of Saturday and Sunday. The effective capital used for sizing and loss accounting is the lesser of InpCapitalCapAmount (default 0, meaning disabled — operators who want to limit the EA's exposure to a subset of their account set InpCapitalCapAmount to a non-zero value) and the actual account equity.
Position sizing runs through CalcLots: 0.5% of effective capital at risk (InpRiskPercent = 0.5), divided by the per-lot loss at the chosen stop distance, with the result floored and clamped to the broker's lot step / min / max. SL is set at 2.0×ATR(14) on the closed bar (configurable via InpATRSLMult, default 2.0); TP is set at 2.0× the resulting R distance (configurable via InpRRTP, default 2.0), giving a 1:2 risk-to-reward ratio. When the broker's SYMBOL_TRADE_STOPS_LEVEL requires a wider stop, the SL/TP distance is widened via MinStopsDist() to honor it.
The ManageExits cascade is four steps run on every tick for any open position with the matching magic and symbol. At +1R, the position moves to break-even (USE_BREAK_EVEN = true, hardcoded). Also at +1R, half the position is closed as a partial take-profit (PARTIAL_TP_PCT = 50.0%, hardcoded), locking in part of the move while leaving the rest in the trade. After that, an ATR-trailing stop at 2.5×ATR(14) (configurable via InpATRTrailMult, default 2.5) ratchets behind the position bar by bar. The fourth step is a time-based exit at MAX_BARS_IN_TRADE = 120 bars (10 hours on M5), enforced via TryClose_EX12006 with the standard three-attempt retry on REQUOTE / TIMEOUT / PRICE_OFF / PRICE_CHANGED.
The OppositeAndRegimeExit sweep runs immediately after ManageExits and closes the position when either the CoreSignal flips to the opposite direction or the regime shifts to CHOPPY, RANGE, or COMPRESS. The 3-consecutive-loss cooldown (COOLDOWN_AFTER_LOSS = 3) is enforced through the OnTradeTransaction handler, which walks DEAL_ENTRY_OUT and DEAL_ENTRY_INOUT events to keep a running loss counter, and when that counter hits 3, g_cooldown_until is set 3 bars into the future and the counter is reset. The result is a USDJPY M5 trend follower with a hard pre-trade filter stack, a layered mid-trade management cascade, and a regime-aware exit hatch.
The default InpDryRun = true means EX12006 ships with live order submission disabled — the EA logs entry attempts in the journal with full SL/TP/sizing detail but never sends a market order. Operators who have validated the behavior in the Strategy Tester should flip InpDryRun to false only after running the EA on a demo account for at least a week and confirming the spread filter, capital floor, and session window are tuned to the broker's actual quote feed. The OnTester custom criterion is (netProfit × profitFactor) / (1 + |balanceDrawdown|), with a 30-trade floor below which the result is forced to 0, which the optimizer uses to rank parameter combinations. SetTypeFillingBySymbol and SetDeviationInPoints(20) are set in OnInit so the EA auto-negotiates the broker's allowed fill policy and accepts up to 2.0 points of slippage per order.
Strategy Deep Dive
EX12006 re-simulates an H1 SuperTrend(10, 3.0) across 200 closed bars inside the SuperTrendDir function, builds a momentum-timeframe Hull MA(20) from WMA primitives in HMAat and WMAat, and watches the M5 EMA(9/21) cross inside CoreSignal — all three votes must agree on the same bar before any direction fires. DetectRegime reads ADX(14), ATR(14), and BB(20, 2.0) on M5 to assign one of seven regime states, with CHOPPY returned on data failure as a hard no-trade signal. The full no-trade stack adds a kill switch, 35-point spread cap, 6-22 server session window, a one-shot news/big-candle block at 3×ATR, the 3-consecutive-loss cooldown, a $50 capital floor, a 3% daily loss limit, and Friday-after-21 plus full-weekend shutdowns. ManageExits runs the +1R break-even + 50% partial + 2.5×ATR trailing cascade, with a 120-bar (10-hour) time exit and a regime-change / opposite-signal close via OppositeAndRegimeExit. InpDryRun ships true by default, so the EA prints but never sends until the operator flips it after demo validation, and SetTypeFillingBySymbol + SetDeviationInPoints(20) in OnInit auto-negotiate the broker fill policy and a 2-point slippage budget. OnTester ranks parameter combinations via (net × PF) / (1 + |DD|) with a 30-trade floor.
Triggers when the M5 EMA(9/21) cross on the just-closed bar, the momentum-timeframe Hull MA(20) slope, and the H1 SuperTrend(10, 3.0) flip all register +1 (BUY) or -1 (SELL) in the same evaluation — a strict 3-of-3 AND gate inside CoreSignal. ConfirmEntry then requires the H1 EMA(50) to agree with the direction on the closed bar and the spread to stay at or below 35 points before any order is dispatched. The 3-of-3 structure makes EX12006 fire far less often than typical M5 trend EAs, so entries are infrequent but high-conviction.
OppositeAndRegimeExit closes the position when the CoreSignal flips to the opposite direction or when the regime classifier returns CHOPPY, RANGE, or COMPRESS. ManageExits fires the +1R break-even move and 50% partial close on the same trigger, after which an ATR-trailing stop at 2.5×ATR(14) follows the residual half, and a 120-bar (10-hour M5) time exit forces a flat via TryClose_EX12006. A 3-consecutive-loss cooldown (3 bars / 15 minutes M5) is enforced by OnTradeTransaction after each DEAL_ENTRY_OUT or DEAL_ENTRY_INOUT event.
Stop loss is set at 2.0×ATR(14) on the closed bar with a hard floor at the broker's SYMBOL_TRADE_STOPS_LEVEL via MinStopsDist(). At +1R the stop is ratcheted to break-even inside ManageExits; from there, a 2.5×ATR(14) trailing stop follows price forward bar by bar.
Take profit is set at 2.0× the R distance (InpRRTP default 2.0), giving a 1:2 risk-to-reward ratio. At +1R, 50% of the position is closed as a partial take-profit (PARTIAL_TP_PCT = 50.0% hardcoded), leaving the residual half under the trailing stop and the original TP. A regime-change to CHOPPY / RANGE / COMPRESS or a 120-bar time stop also forces a flat.
Designed for USDJPY on M5 with the H1 trend and M15 momentum timeframes wired in as the intended deployment, with a minimum recommended balance of $100 — the capital floor is $50 and 0.5% risk per trade, so $200+ gives per-trade sizing meaningful headroom. Best paired with a low-spread ECN broker because the 35-point spread cap and 2.0-point slippage budget assume ECN-class execution. The 6:00-22:00 server session window targets the London-through-New-York overlap, when USDJPY sees the deepest liquidity and the matrix has the most reliable vote counts. InpDryRun ships true by default, so the EA starts in print-only mode and must be flipped to false after demo validation to enable live orders.
Strategy Logic
Pipsgrowth EX12006 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212006
Version: 2.00
BRIEF:
Preserves the original 1228 MTF Matrix thesis: 3-of-3 agreement (AND gate) across three timeframes — H1 SuperTrend flip, M15 Hull-MA slope, M5 EMA cross on closed bar. BUY when all 3 = +1 / SELL when all 3 = -1. All inlined from native primitives (iMA/iATR/iADX/iBands + iHigh/iLow/iClose) — no iCustom. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- MAFast
- MASlow
ADXATRBBATR_M15ATR_H1HTFEMA
KEY FUNCTIONS:
NormPrice()ClampVol()MinStopsDist()SpreadPoints()InSession()IsNewBar()EffectiveCapital()RealizedPnLToday()CountMyPositions()WMAat()HMAat()HullSlope()- ...and 13 more
INTERNAL CONSTANTS (1 total):
BIG_CANDLE_ATR_MULT=3.0// ===================GLOBALS/HANDLES==============================
INPUT PARAMETERS (20 total across 6 groups):
- [=== Identity ===]
InpMagic=22212006// Magic number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12006" // Trade comment - [=== Signal:
MTFMatrix(3-of-3 AND) ===]InpTF_Trend= 8 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) //H1trendTF(SuperTrendvote) - [=== Signal:
MTFMatrix(3-of-3 AND) ===]InpTF_Mom= 6 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) //M15momentumTF(Hull vote) - [=== Signal:
MTFMatrix(3-of-3 AND) ===]InpFastEMA= 9 //M5FastEMAperiod (bars) - [=== Signal:
MTFMatrix(3-of-3 AND) ===]InpSlowEMA= 21 //M5SlowEMAperiod (bars) - [=== Signal:
MTFMatrix(3-of-3 AND) ===]InpHullPeriod= 20 //M15Hull MA period (bars) - [=== Regime Gate ===]
InpADXMin=20.0// MinADXforWeakTrend - [=== Regime Gate ===]
InpATRPctLookback= 60 //ATRpercentile lookback (bars) - [=== Confirm & No-Trade ===]
InpHTFEMA= 50 //HTF(H1)EMAperiod for confirm - [=== Confirm & No-Trade ===]
InpMaxSpreadPts=35.0// Max spread (points,USDJPY-tuned) - [=== Risk & Sizing ===]
InpDryRun=true// Dry-run: no real sends - [=== Risk & Sizing ===]
InpKillSwitch=false// Kill switch (closes all on tick) - [=== Risk & Sizing ===]
InpCapitalCapAmount=0.0// Capital cap amount ($ equity) - [=== Risk & Sizing ===]
InpCapitalCapFloor=50.0// Capital cap floor ($) - [=== Risk & Sizing ===]
InpRiskPercent=0.5// Risk per trade (% of eff. cap) - [=== Risk & Sizing ===]
InpDailyLossLimit=3.0// Daily loss limit (% of eff. cap) - [=== Risk & Sizing ===]
InpATRSLMult=2.0// SL =ATRx mult - [=== Risk & Sizing ===]
InpRRTP=2.0// TP = R x mult (R = SL dist) - [=== Manage & Exit ===]
InpATRTrailMult=2.5//ATRtrail distance (xATR)
// Pipsgrowth EX12006 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Preserves the original 1228 MTF Matrix thesis: 3-of-3 agreement (AND gate) across three timeframes — H1 SuperTrend flip, M15 Hull-MA slope, M5 EMA cross on closed bar. BUY when all 3 = +1 / SELL when all 3 = -1. All inlined from native primitives (iMA/iATR/iADX/iBands + iHigh/iLow/iClose) — no iCustom. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
ON_INIT:
Create indicator handles: MAFast, MASlow, ADX, ATR, BB, ATR_M15, ATR_H1, HTFEMA
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 |
|---|---|---|
| InpMagic | 22212006 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12006" | Trade comment |
| InpTF_Trend | 8 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // H1 trend TF (SuperTrend vote) |
| InpTF_Mom | 6 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // M15 momentum TF (Hull vote) |
| InpFastEMA | 9 | M5 Fast EMA period (bars) |
| InpSlowEMA | 21 | M5 Slow EMA period (bars) |
| InpHullPeriod | 20 | M15 Hull MA period (bars) |
| InpADXMin | 20.0 | Min ADX for WeakTrend |
| InpATRPctLookback | 60 | ATR percentile lookback (bars) |
| InpHTFEMA | 50 | HTF (H1) EMA period for confirm |
| InpMaxSpreadPts | 35.0 | Max spread (points, USDJPY-tuned) |
| InpDryRun | true | Dry-run: no real sends |
| InpKillSwitch | false | Kill switch (closes all on tick) |
| InpCapitalCapAmount | 0.0 | Capital cap amount ($ equity) |
| InpCapitalCapFloor | 50.0 | Capital cap floor ($) |
| InpRiskPercent | 0.5 | Risk per trade (% of eff. cap) |
| InpDailyLossLimit | 3.0 | Daily loss limit (% of eff. cap) |
| InpATRSLMult | 2.0 | SL = ATR x mult |
| InpRRTP | 2.0 | TP = R x mult (R = SL dist) |
| InpATRTrailMult | 2.5 | ATR trail distance (x ATR) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12006 USDJPY MTF Matrix — H1 SuperTrend + M15 Hull + M5 EMA cross, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
#include <Trade\OrderInfo.mqh>
#include <Trade\DealInfo.mqh>
CTrade g_trade;
CPositionInfo g_pos;
CSymbolInfo g_sym;
CAccountInfo g_acc;
//=================== INPUTS (20 total) =============================
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_InpTF_Trend = PERIOD_H1;
ENUM_TIMEFRAMES g_InpTF_Mom = PERIOD_H1;
input group "=== Identity ==="
input long InpMagic = 22212006; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_12006"; // Trade comment
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M5;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.