Pipsgrowth EX12065 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · XAUUSD · M5
Pipsgrowth.com EX12065 Gen2_RSA_Gold — Gaussian bands with RSI on Gold, full 12-layer stack.
Overview
EX12065 — Gen2_RSA_Gold — is a 4-handle breakout EA that adds an RSI directional filter to the Gaussian-band framework that runs across the rest of the EX12 family. The header reads "Gen2" because the previous generation in the family was the pure Gaussian/Alligator/Donchian stack; this one keeps the Gaussian band construction but drops the Alligator, Donchian, ADX, D1 and W1 optional filters and instead hard-codes RSI(14) as a confirmation layer on every entry and as the trigger on every exit. The file is short — 16 functions, 21 inputs, 0 defines — and the architecture is small enough to walk through end to end.
The band construction starts with a 10-period EMA on the working timeframe, which the code calls the GaussianFilter. Two bands are drawn around that midline at ±DistanceMultiplier × ATR(14), with DistanceMultiplier = 0.85 by default. So if the midline sits at 1900.00 and ATR is 4.50, the upper band is at 1903.83 and the lower band at 1896.18. The midline itself, not the close, is the reference: the EA tracks gaussNow and gaussPrev to confirm slope direction.
Entry conditions are stacked, not OR'd. The first gate is the strong-candle filter — body must be at least 60% of the candle's full range. The second is the band cross with a 2-bar confirmation: today's close must be above the upper band while the previous two closes were both below it (mirror for sells). The third is the trend gate — close must be on the correct side of a 50-period EMA on the higher timeframe, defaulting to H4 (TrendFilterTF = 6). The fourth is slope — gaussNow > gaussPrev for buys. The fifth is break distance — price − gaussNow > 0.3 × ATR, which prevents the EA from buying noise that barely pokes through the band. The sixth and decisive gate is the RSI confirmation. With RSI_Period = 14 and UseRSIForEntries = true, a long requires rsi < 70 AND rsiPrev < rsi — that is, RSI is below overbought AND rising. A short requires rsi > 30 AND rsiPrev > rsi. That "rising RSI on a bullish break" filter is what makes the Gen2_RSA label earn its name: the RSI is not decoration, it gates every trade.
Before sending the order, CloseOpposite() walks the open positions and closes any that are on the wrong side. This is a directional pre-filter, not a hedge: if the EA is already long and a short signal prints, the long is closed first and then the short opens. The trade objects use trade.Buy(Lots, _Symbol, ask, slBuy, tpBuy, InpTradeComment) with Lots = 0.1 fixed, slBuy = ask − 1.2 × ATR, tpBuy = ask + 160 × _Point, and the Psgrowth.com Expert_12065 comment. HardSL_Points = 120 is the fallback used when ATR returns 0; the live SL scales with volatility.
Position management runs on every tick after a position exists. The ATR trailing stop is the first layer: if the new computed stop is on the right side of the current stop, TryModify_EX12065() pushes it. The breakeven layer is the second: once bid − entry > 1.2 × ATR (the same multiple as the trailing ATR), the stop is ratcheted to entry. The dynamic lock-profit layer is the third: with LockProfitEvery_X_Dollars = 2.0 and LockMinusBuffer = 1.0, every $2 of unrealized profit steps the lock up by $1, so at $4.20 of profit the lock sits $3 above entry (2 steps × $2 − $1 buffer). Each layer is forward-only — none of them widen the stop.
The exit system is where the Gen2_RSA architecture pulls its weight. After the position-management block, the EA reads RSI on bars 0, 1, and 2 and computes rsiTrendUp = rsi > rsiPrev > rsiPrev2 (and the mirror for down). With UseRSIEarlyExit = true and RSI_ExitConfirmationPeriods = 2, the EA counts how many of the last 2 RSI prints are overbought (for a long position) or oversold (for a short). If both bars qualify and UseRSITrendForExit = true, the EA also requires rsiTrendDown to confirm a long exit. There is a fourth, optional exit — UseRSIDivergenceExit = false by default — that fires when price makes a higher high but RSI makes a lower high (or the mirror) within the last 3 bars. None of these exits are TP-replacement: the fixed 160-point TP is still on the ticket and will close the trade naturally.
The capital cap and the session cap close out the system. CheckMaxDrawdown() returns false once 100 × (balance − equity) / balance > MaxDrawdownPercent (10.0), and OnTick exits early when that flips. The Friday machinery is built around a 17:00 server-time market close: between 15:00 and 17:00 on Friday, IsNearFridayClose() returns true, and if CloseTrades2HoursBeforeFriday = true the EA calls CloseAllPositions() and returns. If AvoidTrading2HoursBeforeFriday = true, no new entries can fire in that window either. The AutoTuneFilters() function sniffs the live ASK-BID spread and toggles pipFactor between 0.0001 and 0.01, which is what lets the same MinATR = 0.03 default work on both 4-digit FX pairs and 2-digit XAUUSD. UseAutoFilter = true flips this on by default; setting it to false makes the EA use the raw MinATR and MinBreakDistance values from the inputs.
There are a few other inputs worth knowing. OneTradeOnly = true means the EA is effectively single-position — even though MaxOpenTrades = 5 is exposed, the canTrade clause only allows an entry when no position exists. AllowOnlyProfitableAdditions = true plus MinProfitPerTradeToAdd = 5.0 is a redundant guard: with OneTradeOnly active, every existing position has to be sitting on at least $5 of unrealized profit before another can open. UseRSIForEntries, UseRSIEarlyExit and UseRSITrendForExit are all on by default; UseRSIDivergenceExit is the only RSI input that ships off. The three retry wrappers — TryClose_EX12065, TryClosePartial_EX12065 and TryModify_EX12065 — handle REQUOTE, TIMEOUT, PRICE_OFF and PRICE_CHANGED with 3 attempts and 200ms (or 100ms for modify) sleeps.
What to expect in a backtest: a 4-handle EA with single-position discipline and 6-gate entries should print a low-frequency, high-conviction equity curve. The 2-bar band confirmation and the 0.3×ATR break distance will keep win rate elevated in trending gold sessions but will cause the EA to miss the first 1-2 bars of every impulse — the trade-off is fewer whipsaw losses in exchange for entering late. The dynamic lock-profit is a meaningful contributor: the $1 buffer is what makes the system give back some open profit on pullbacks rather than getting stopped at breakeven, so expect realized R to be slightly worse than the gross R the trade would have printed at peak. The 10% drawdown cap is the only account-level kill switch — when the EA hits it, it stops opening new trades for the day but does not close existing ones. Pair this EA with an ECN-style account so the 0.85×ATR bands and the 1.2×ATR trailing stop do not get eaten by spread on every re-quote.
Strategy Deep Dive
On every tick, the EA first checks the capital cap and the Friday window, then runs AutoTuneFilters() to derive minATR / breakDistance / bandMult from the live spread, and skips the tick if ATR is below the floor. With 4 handles (iMA(10) for the Gaussian midline, iATR(14), iMA(50) on the H4 trend filter, and iRSI(14)), it pulls gaussNow, gaussPrev, the bands, the HTF EMA, the strong-candle body/range, and the RSI prints. If canTrade is true (no position open, count below MaxOpenTrades, all existing positions carrying ≥ $5 of profit, Friday window clear) and the candle qualifies, the entry gates run in order: 2-bar band cross, slope, break distance, HTF trend, and the RSI rising/falling check. CloseOpposite() flattens the wrong side before trade.Buy / trade.Sell sends the order at 0.1 lot, sl = 1.2 × ATR, tp = 160 pts. The position-management block then layers the ATR trailing, the breakeven ratchet, and the dynamic lock-profit — all wrapped in 3-retry TryModify_EX12065 calls. The exit block reads RSI on bars 0/1/2, counts overbought/oversold confirmation periods, optionally checks trend and divergence, and TryClose_EX12065 the position when the exit fires.
Long entries trigger when six conditions stack: a strong candle (body ≥ 60% of range) closes above the upper Gaussian band (midline + 0.85 × ATR) with the previous two closes still below it, the close is above the H4 EMA(50) trend gate, gaussNow slopes up, price − gaussNow exceeds 0.3 × ATR, and RSI(14) is below 70 with rsiPrev < rsi (RSI rising). The short mirror requires the opposite on every condition, with RSI above 30 and falling. CloseOpposite() flushes any opposite-side position before the new order fires.
The EA exits on three layers: the fixed 160-point TP, the dynamic lock-profit ratchet (stepping every $2 with a $1 buffer), and an RSI early-exit that fires when 2 consecutive bars of overbought (or oversold) RSI are confirmed with the trend direction turning against the position. An optional divergence exit (default off) closes the trade when price makes a higher high but RSI makes a lower high within 3 bars.
Stop loss is anchored to the ATR(14) on the working timeframe at 1.2 × ATR (with HardSL_Points = 120 as a fallback when ATR returns 0). The stop is ratcheted to breakeven once bid − entry exceeds 1.2 × ATR, and then the dynamic lock-profit layer pushes it forward in $2/$1 increments. Trailing and lock-profit are forward-only — the stop is never widened.
Take profit is fixed at 160 points on the order ticket (FixedTP_Points = 160), with tpBuy = ask + 160 × _Point and tpSell = bid − 160 × _Point. The TP is independent of the ATR and does not scale with volatility — every position has the same nominal target unless the RSI early-exit or the lock-profit ratchet closes it first.
Best for XAUUSD M5 traders running a single-position gold system on an ECN or low-spread account with at least $100 in margin. The Gen2_RSA architecture is tuned for the London and New York overlap sessions, when gold's volatility sustains 1.2 × ATR breaks of the 0.85 × ATR Gaussian bands. Conservative users should leave UseRSIDivergenceExit off and rely on the 2-bar RSI overbought/oversold confirmation; aggressive users can flip it on to catch tops and bottoms on the H4 timeframe. The 10% drawdown cap and the 15:00-17:00 server-time Friday close make it a candidate for a sub-account dedicated to gold rather than a multi-EA portfolio slot.
Strategy Logic
Pipsgrowth EX12065 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212065
Version: 2.00
BRIEF:
Adaptive breakout EA using Gaussian volatility bands with RSI entry/exit confirmation, ATR-based SL, HTF EMA trend alignment, dynamic lock profit, max drawdown control, trailing stop, breakeven, and Friday close management. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
GetBuffer()GaussianFilter()GetATR()GetEMA_HTF()GetRSI()PositionExists()CloseOpposite()AutoTuneFilters()CheckMaxDrawdown()CountOpenTrades()AllPositionsHaveMinProfit()IsNearFridayClose()- ...and 4 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (21 total across 6 groups):
- [=== Strategy ===] Timeframe = 0 //
Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) - [=== Strategy ===]
TrendFilterTF= 6 //Timeframe(1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) - [=== Money Management ===]
MaxDrawdownPercent=10.0// Max drawdown % allowed - [=== Trade Management ===]
MaxOpenTrades= 5 // Maximum allowed open trades at the same time - [=== Trade Management ===]
AllowOnlyProfitableAdditions=true// Enable filter - [=== Trade Management ===]
MinProfitPerTradeToAdd=5.0// Minimum $ profit required per existing trade - [=== Trade Management ===]
LockProfitEvery_X_Dollars=2.0// Step: every $6 profit - [=== Trade Management ===]
LockMinusBuffer=1.0// Lock profit minus $1 buffer - [===
RSIParameters ===] RSI_Period = 14 //RSIPeriod - [===
RSIParameters ===] RSI_Overbought = 70 //RSIOverboughtlevel - [===
RSIParameters ===] RSI_Oversold = 30 //RSIOversoldlevel - [===
RSIParameters ===]UseRSIEarlyExit=true// UseRSIfor early exit - [===
RSIParameters ===]UseRSIForEntries=true// UseRSIfor trade entries - [===
RSIParameters ===] RSI_ExitConfirmationPeriods = 2 // Periods to confirmRSIexit signal - [===
RSIParameters ===]UseRSITrendForExit=true// UseRSItrend direction for exit - [===
RSIParameters ===] RSI_ExitSensitivity =1.5//RSIsensitivity multiplier for exit - [===
RSIParameters ===]UseRSIDivergenceExit=false// UseRSIdivergence for exit - [=== Friday Control ===]
CloseTrades2HoursBeforeFriday=true// Close all trades 2 hours before Friday close - [=== Friday Control ===]
AvoidTrading2HoursBeforeFriday=true// Don't open trades 2 hours before Friday close - [=== Identity ===]
InpMagicNumber=22212065// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_12065" // TradeComment
// Pipsgrowth EX12065 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Adaptive breakout EA using Gaussian volatility bands with RSI entry/exit confirmation, ATR-based SL, HTF EMA trend alignment, dynamic lock profit, max drawdown control, trailing stop, breakeven, and Friday close management. 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 |
|---|---|---|
| Timeframe | 0 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) |
| TrendFilterTF | 6 | Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) |
| MaxDrawdownPercent | 10.0 | Max drawdown % allowed |
| MaxOpenTrades | 5 | Maximum allowed open trades at the same time |
| AllowOnlyProfitableAdditions | true | Enable filter |
| MinProfitPerTradeToAdd | 5.0 | Minimum $ profit required per existing trade |
| LockProfitEvery_X_Dollars | 2.0 | Step: every $6 profit |
| LockMinusBuffer | 1.0 | Lock profit minus $1 buffer |
| RSI_Period | 14 | RSI Period |
| RSI_Overbought | 70 | RSI Overbought level |
| RSI_Oversold | 30 | RSI Oversold level |
| UseRSIEarlyExit | true | Use RSI for early exit |
| UseRSIForEntries | true | Use RSI for trade entries |
| RSI_ExitConfirmationPeriods | 2 | Periods to confirm RSI exit signal |
| UseRSITrendForExit | true | Use RSI trend direction for exit |
| RSI_ExitSensitivity | 1.5 | RSI sensitivity multiplier for exit |
| UseRSIDivergenceExit | false | Use RSI divergence for exit |
| CloseTrades2HoursBeforeFriday | true | Close all trades 2 hours before Friday close |
| AvoidTrading2HoursBeforeFriday | true | Don't open trades 2 hours before Friday close |
| InpMagicNumber | 22212065 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_12065" | Trade Comment |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX12065 Gen2_RSA_Gold — Gaussian bands with RSI on Gold, full 12-layer stack."
#include <Trade\Trade.mqh>
CTrade trade;
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_TIMEFRAMES g_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
input group "=== Strategy ==="
input bool UseAutoFilter = true;
input int Length = 10;
input double DistanceMultiplier = 0.85;
input int Timeframe = 0; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
input int TrendFilterTF = 6; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)
input int TrendEMA = 50;
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_TIMEFRAMES g_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
input group "=== Money Management ==="
input double Lots = 0.1;
input bool OneTradeOnly = true;
input double ATR_MultiplierSL = 1.2;
input double HardSL_Points = 120;
input double FixedTP_Points = 160;
input bool UseTrailingStop = true;
input bool UseBreakeven = true;
input double MinATR = 0.03;
input double MinBreakDistance = 0.3;
input double MaxDrawdownPercent = 10.0; // Max drawdown % allowed
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.