P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12071 MultiIndicatorConfluence

MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1

Pipsgrowth.com EX12071 MultiStrategy_Combo — SuperTrend+EMA+RSI+MACD combo with inside-bar trigger, full 12-layer stack.

Overview

Pipsgrowth EX12071 is a 4-confluence trend-following EA that only fires when an EMA crossover agrees with a hand-rolled SuperTrend, an RSI-14 bias, and the MACD-12/26/9 polarity — and then pyramids the same direction up to three times using an inside-bar breakout. The whole stack is built on the 5-handle footprint of iMA(9) + iMA(21) + iRSI(14) + iMACD(12,26,9) + iATR(14), with a CSuperTrend class running its own bands on top of the same iATR(14) feed. Every new bar the OnTick path copies 3 candles of each buffer, updates the SuperTrend series, runs CheckExits, then CheckEntries.

The primary signal is the EMA-9/EMA-21 cross on the chart timeframe. A long setup requires g_bufEMA_Fast[1] > g_bufEMA_Slow[1] AND g_bufEMA_Fast[2] <= g_bufEMA_Slow[2] — i.e. the cross just closed on bar 1. But the cross alone is not enough: g_st.GetDirection(1) must return +1 (the SuperTrend flip is already up on the closed bar), g_bufRSI[1] must print above InpRSI_Level=50.0, and g_bufMACD_Main[1] must sit above g_bufMACD_Sig[1]. All four conditions are AND-wired. A short setup is the mirror: xDn && stBear && rsiBear && macdBear, with InpEnableLongs and InpEnableShorts acting as a directional kill switch. When the book is flat, the first qualifying bar opens a single trade at the risk-based lot size; it never opens both directions at once because longs and shorts use the same magic number 22212071 but trade under different CTrade instances (g_tradeL, g_tradeS).

Pyramiding is the second personality of the EA and is gated by InpUseInsideBar=true, InpMaxPositions=3, and InpPyramidPips=20. Once a primary long is in the book, CheckEntries looks for an inside-bar pattern: the most recent closed bar's high must be lower than the prior bar's high (h1 < h2) AND the most recent closed bar's low must be higher than the prior bar's low (l1 > l2). When that pattern shows up AND SuperTrend is still bullish, the EA waits for a tick to break above h1 by at least one point, then calls ExecuteTrade again — but only if IsLastPosProfitable() confirms the most recent long is in profit by more than 20 pips. A 1-bar debounce gate (TimeCurrent() - LastPosTime() > PeriodSeconds()) keeps the EA from firing twice on the same candle. The same logic runs in the short branch with the mirror break (bid < l1).

Lot sizing is the standard equity-fraction model. CalculateLot(slDist, riskPct) computes riskMoney = equity * riskPct/100, divides by per-tick loss (slDist/tickSize * tickValue), then snaps to the symbol's SYMBOL_VOLUME_STEP and clamps to min/max. The pyramid scaling multiplies the base risk by InpLotMultiplier=0.5 for each existing position in the same direction: the second add-on is sized at 0.5x the original, the third at 0.25x. So instead of martingale-style expansion, the EA contracts size into a winning trend. Stop-loss and take-profit are ATR-anchored at the time of entry: finalSL = price ± 2.0 * ATR (InpStopLossATR=2.0), finalTP = price ± 4.0 * ATR (InpTakeProfitATR=4.0). That gives a static 1:2 risk-to-reward on every leg of the pyramid.

There are three exit paths. CheckExits() looks for an EMA opposite-cross on the closed bar — if the fast EMA slips under the slow EMA while a long is in the book, every long is closed at market. ManageTrailing() does the dynamic work: it reads g_st.GetDirection(0) on bar 0 to detect a SuperTrend flip in real time, and on flip it liquidates the entire directional book via CloseAll(). If the SuperTrend has not flipped, ManageTrailing() ratchets every position's stop to the closed-bar SuperTrend band level (g_st.GetValue(1)) — but only when the new ST level is on the correct side of the open stop. Longs trail the ST lower band; shorts trail the ST upper band. The static ATR TP sits at 4x ATR until either an EMA opposite-cross, an ST flip, or the fixed TP level is hit.

The capital cap is the brute-force safety valve. On every tick, OnTick() reads equity and walks a running peak (g_maxEquity). If (peak − current)/peak × 100 ≥ InpMaxDDPercent=15.0, the EA sets g_stopped=true, prints 'Max DD Hit', and never re-enters until the chart is restarted. This is a hard halt, not a soft close — the EA does not auto-reduce lots or re-attempt after recovery, it just stops. There is also a session/spread pre-filter at the top of OnTick: if SymbolInfoInteger(_Symbol, SYMBOL_SPREAD) > InpMaxSpread=40 (i.e. >4.0 pips on a 5-digit broker or 40 points on a 4-digit feed), the tick is dropped. Combined, these two rules mean the EA will not pile into a runaway move when spreads widen and will not keep trading once a 15% peak-to-trough drawdown has been spent.

The retry helpers (TryClose_EX12071, TryClosePartial_EX12071, TryModify_EX12071) follow the standard 3-attempt / 200ms-close / 100ms-modify pattern on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED return codes. They sit in the source as utilities but the live order flow goes through g_tradeL and g_tradeS directly, so the wrappers function as a public-API safety net for any future partial-close logic. What this means in practice: the EA is tuned for XAUUSD M5H1 on a low-spread ECN. The 40-point spread filter is generous for FX majors but tight for gold during rollover, so most users run it on a gold sub-account with a sub-25-point raw spread. With $100 minimum and 1% risk, the first leg is a 0.0X-lot probe; the pyramid legs scale down, so worst-case exposure grows roughly geometrically but never past the 15% drawdown trip. Backtests on the published inputs are best reproduced with 'Every tick' mode and real ticks from the broker's history because the inside-bar trigger is sensitive to spread spikes that bar-open models mask.

Strategy Deep Dive

OnTick runs the standard five-handle refresh first: 3 candles of iMA(9), iMA(21), iRSI(14), iMACD main+signal, and iATR(14) get copied into the global buffers, then the CSuperTrend class walks 200 bars to rebuild its upper/lower bands and trend direction. The 15% peak-equity drawdown cap and 40-point spread filter gate the whole tick before any signal work. CheckEntries then evaluates the four-way AND: EMA cross on bar 1, SuperTrend direction +1/-1, RSI vs the 50 level, MACD main-vs-signal polarity. A new primary entry fires only when the directional book is flat. When the book already has positions, the same call switches to pyramiding mode and looks for an inside-bar pattern followed by a tick break of the inside high or low — gated by 20-pip profitability on the last position and a one-bar debounce. The two retry helpers (TryClose, TryModify) sit in the source as utilities on a third CTrade instance but the live order flow goes through g_tradeL and g_tradeS directly, so they don't slow the entry path. The 0.5x lot multiplier compounds downward per pyramid step (1.0x, 0.5x, 0.25x) instead of expanding, so the third leg of a trend is the smallest.

Entry Signal

Entries require four stacked confirmations on the closed bar: EMA(9) crossing above EMA(21) with the prior bar inverted, SuperTrend direction = +1, RSI(14) > 50, and MACD main > signal. A short entry is the mirror image (EMA down-cross + ST = -1 + RSI < 50 + MACD main < signal). Pyramiding adds legs on inside-bar breakouts (h1l2) only when the most recent position is profitable by more than 20 pips and at least one bar has elapsed since the last entry. InpEnableLongs / InpEnableShorts act as a per-direction kill switch.

Exit Signal

Three exit paths run in sequence each tick. CheckExits closes the entire directional book when the EMA cross inverts on the closed bar. ManageTrailing closes immediately on a SuperTrend flip on bar 0; otherwise it ratchets each position's stop to the closed-bar SuperTrend band level, only tightening. The third exit is the static 4× ATR take-profit that was set at entry.

Stop Loss

Per-trade stop-loss is fixed at entry: price ± 2.0 × ATR(14). After entry, ManageTrailing ratchets the stop upward (longs) or downward (shorts) to the closed-bar SuperTrend band level, only when the new level is tighter than the current stop. No breakeven ratchet, no manual override.

Take Profit

Per-trade take-profit is fixed at entry: price ± 4.0 × ATR(14), giving a 1:2 R:R against the 2.0× ATR stop. There is no partial-close, no trailing TP, and no TP ratchet — once the bar reaches the TP level the position is closed at market.

Best For

Best on XAUUSD M5 or H1 with $100 minimum balance at 1% risk per trade. Use a low-spread ECN or RAW-spread account — the 40-point spread filter is tight for gold during rollover, so a sub-25-point raw spread on a gold sub-account is the realistic operating range. Suits traders who want a single-direction trend-following EA with built-in pyramiding on the same M5 chart rather than a grid or hedge setup; the 15% peak-equity drawdown cap is a hard halt, so capital preservation is built into the runtime, not just the backtest.

Strategy Logic

Pipsgrowth EX12071 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)

Family: MultiIndicatorConfluence Magic: 22212071 Version: 2.00

BRIEF: Multi-strategy combo EA combining SuperTrend + EMA trend with RSI/MACD filters and inside-bar trigger, pyramiding and ATR-based SL/TP with drawdown protection. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • GetGlobalATR()
  • CheckExits()
  • CheckEntries()
  • ExecuteTrade()
  • CalculateLot()
  • ManageTrailing()
  • CloseAll()
  • CountPositions()
  • LastPosTime()
  • IsLastPosProfitable()
  • TryClose_EX12071()
  • TryClosePartial_EX12071()
  • ...and 1 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (5 total across 5 groups):

  • [=== Strategy Configuration ===] InpTradeComment = "Psgrowth.com Expert_12071" // Trade Comment
  • [=== Filters (RSI + MACD) ===] InpRSI_Level = 50.0 // MACD Standard (12, 26, 9)
  • [=== Trigger (Inside Bar) ===] InpUseInsideBar = true // Turn off to trade pure trend? No, keep as trigger.
  • [=== Risk Management ===] InpLotMultiplier = 0.5 // Pyramid scaling
  • [=== Safety ===] InpMaxSpread = 40 // +------------------------------------------------------------------+
Pseudocode
// Pipsgrowth EX12071 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Multi-strategy combo EA combining SuperTrend + EMA trend with RSI/MACD filters and inside-bar trigger, pyramiding and ATR-based SL/TP with drawdown protection. 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

Optimized Brokers:
ExnessIC Markets
Optimized Symbols:
XAUUSD
Optimized Timeframes:
M5H1

How to Install This EA on MT5

  1. 1Download the .mq5 file using the button above
  2. 2Open MetaTrader 5 on your computer
  3. 3Click File → Open Data Folder in the top menu
  4. 4Navigate to MQL5 → Experts and paste the .mq5 file there
  5. 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
  6. 6Drag the EA onto a chart matching the recommended timeframe
  7. 7Configure parameters according to the table on this page
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
InpTradeComment"Psgrowth.com Expert_12071"Trade Comment
InpRSI_Level50.0MACD Standard (12, 26, 9)
InpUseInsideBartrueTurn off to trade pure trend? No, keep as trigger.
InpLotMultiplier0.5Pyramid scaling
InpMaxSpread40+------------------------------------------------------------------+
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12071.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12071 MultiStrategy_Combo — SuperTrend+EMA+RSI+MACD combo with inside-bar trigger, full 12-layer stack."

#include <Trade\Trade.mqh>

//+------------------------------------------------------------------+
//| Input Parameters                                                 |
//+------------------------------------------------------------------+
input group "=== Strategy Configuration ==="
input bool     InpEnableLongs       = true;
input bool     InpEnableShorts      = true;
input int      InpMagicNumberL      = 22212071;
input int      InpMagicNumberS      = 22212071;
input string   InpTradeComment      = "Psgrowth.com Expert_12071"; // Trade Comment

input group "=== Trend (SuperTrend + EMA) ==="
input int      InpST_Period         = 14;
input double   InpST_Multiplier     = 3.0;
input int      InpEMA_Fast          = 9;
input int      InpEMA_Slow          = 21;

input group "=== Filters (RSI + MACD) ==="
input int      InpRSI_Period        = 14;
input double   InpRSI_Level         = 50.0;
// MACD Standard (12, 26, 9)
input int      InpMACD_Fast         = 12;
input int      InpMACD_Slow         = 26;
input int      InpMACD_Signal       = 9;

input group "=== Trigger (Inside Bar) ==="
input bool     InpUseInsideBar      = true; // Turn off to trade pure trend? No, keep as trigger.

input group "=== Risk Management ==="
input int      InpMaxPositions      = 3;
input double   InpRiskPercent       = 1.0;
input double   InpLotMultiplier     = 0.5; // Pyramid scaling
input double   InpPyramidPips       = 20.0;
input double   InpStopLossATR       = 2.0; 
input double   InpTakeProfitATR     = 4.0;

input group "=== Safety ==="
input double   InpMaxDDPercent      = 15.0;
input int      InpMaxSpread         = 40;

//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
CTrade g_tradeL;
CTrade g_tradeS;

int    g_emaFastErr, g_emaSlowErr;
int    g_handleEMA_Fast, g_handleEMA_Slow;
int    g_handleRSI;
int    g_handleMACD;
int    g_handleATR;

double g_bufEMA_Fast[], g_bufEMA_Slow[];

Full source code available on download

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

Tags:ex12071multiindicatorconfluencepipsgrowthfreemt5xauusd

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

Community

Sign in to contributeSign In

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

File NamePipsgrowth_com_EX12071.mq5
File Size20.3 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M5H1
Currency Pairs
XAUUSD
Min. Deposit$100