P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX12045 MultiIndicatorConfluence

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

Pipsgrowth.com EX12045 EURUSD_v1 — adaptive scalping EA with AMA, RSI, Heiken Ashi and volatility filter, full 12-layer stack.

Overview

EX12045 is the v1 baseline cut of the MultiIndicatorConfluence family — the cleanest input panel in the lineup at six groups and thirty-five parameters, with no separate entry-mode toggles, no crossover/divergence sub-banks, and no breakout/mean-reversion switches bolted on top. The whole trade decision collapses to one line: a four-way AND-stack on each tick of a new bar, and that line is the same one the live path has always used. Later siblings in the family add per-mode flags and a broader input bank; this file ships without them, which makes it the most direct expression of the underlying confluence idea in the .mq5 tree.

The signal path is short. On every new bar, OnTick() calls UpdateAdaptiveIndicators(), which in turn calls four code-level calculators — CalculateAdaptiveVolatility(), CalculateAdaptiveMA(), CalculateRSI(), and CalculateHeikenAshi() — that fill seven manually-populated 100-element arrays (adaptiveMA, volatility, rsiBuffer, haOpen, haClose, haHigh, haLow) without ever allocating a native MT5 indicator handle. The "adaptive moving average" is in fact a plain SMA whose period is recomputed from the current bar's high-low range relative to a twenty-bar average: adaptivePeriod = round(AdaptiveMA_Period / (1 + (volRatio - 1) * AdaptiveMA_Sensitivity)), then clamped to the [5, 50] integer band. Higher recent volatility shortens the average; quieter markets lengthen it back toward the base period of 14. The Wilder-style RSI is a textbook implementation summing closes over ConfirmationRSI_Period (default 14) bars, with a neutral seed of 50 in the buffer and the up-sum-over-down-sum RS formula. The Heiken Ashi candles are constructed in code (haClose = (O+H+L+C)/4, recursive haOpen[i] = (haOpen[i-1] + haClose[i-1]) / 2), not pulled from a chart indicator — so disabling UseHeikenAshi swaps the comparison over to raw candle close, but the buffer is still built every tick regardless.

GetBuySignal() and GetSellSignal() are mirror images and each return a single boolean from a small AND chain. Buy fires when the working price is above the adaptive MA, AND either a fresh crossover happened on the most recent bar OR a strong bullish candle appeared with body larger than fifty percent of its full range, AND the latest volatility reading clears the VolatilityThreshold * pointValue floor (0.3 points by default). Sell reverses every comparison. After the signal, GetConfirmationSignal() gates the trade on the RSI sitting inside the 30-70 corridor, with a volumeConfirm flag hard-wired true because retail EURUSD rarely has trustworthy tick-volume data. Three further gates sit between the signal and the order ticket: IsMarketConditionsOK() blocks entries when the spread exceeds MaxSpread (5 points) or, more strictly, when it exceeds 2x MaxSpread as a hard extreme-spike cut-off, or when the equity drawdown breaches MaxDrawdownPercent (10%), or when total open positions on this magic have already hit MaxOpenTrades (5). IsPositionManagementOK() walks every open position for the magic and demands that all of them be at or above MinProfitInPointsPerTradeToAdd (20 points) before any new entry is allowed — a one-strike-and-you're-out rule that prevents the EA from doubling into a losing basket. IsOptimalTradingSession() short-circuits to true when the tester flag is set, which means strategy-tester curves will look smoother than live forward runs once the session filter is engaged.

Order construction is plain CTrade: a market order at the current ask (or bid for sells) with a stop of StopLossPoints * pointValue (50 points) below and a take profit of TakeProfitPoints * pointValue (100 points) above — a 1:2 reward-to-risk on the initial ticket — using the fixed LotSize input (1.0 by default) regardless of MaxRiskPerTrade. Slippage tolerance is the Slippage input (3 points). When the same-direction position count is already above zero and AllowOnlyProfitableAdditions is true, the code re-checks IsPositionDirectionProfitable() for that specific type before sending a pyramid entry; this is a tighter check than the global position-management gate, but it uses the same 20-point threshold. RequireToCheckForConfirmationBeforeAdding forces the RSI corridor to be alive on the current bar before any addition, even on the first pyramid.

Position management runs every tick, not just on new bars, through ManagePositions()ManageDynamicStopLoss(). The watermark ratchet tracks lastHighestProfit[positionIndex] per ticket, computes lockSteps = floor(peak / LockProfitEvery_X_Points) (every 30 points of unrealized gain), and proposes a new stop at PriceOpen + lockSteps * 30 - LockMinusBuffer (the 15-point buffer keeps the lock a hair below the round number). The modification only fires when the proposed stop is strictly better than the existing one, so the ratchet can only tighten — it never loosens. The TryModify_EX12045 helper retries the modify up to three times with a 100ms sleep on REQUOTE/TIMEOUT, and TryClose_EX12045 / TryClosePartial_EX12045 do the same for full and partial closes with a 200ms sleep on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED.

What this v1 file deliberately does not do is just as important as what it does. The .mq5 allocates zero native indicator handles — no iRSI, no iATR, no iBands, no iMACD calls anywhere in OnInit — so the visible inputs in the panel that read like crossover, divergence, breakout, mean-reversion, and HA-confirmation toggles on the later siblings are absent here. The single UseHeikenAshi boolean chooses between HA-built and raw-candle price comparison; that is the only signal-mode switch on the file. There is no ManagePositions body doing partial closes or basket TP, no working IsOptimalTradingSession curve for live trading, and no per-mode divergence routine. The 10% MaxDrawdownPercent global cap is the load-bearing safety in the absence of those features: if a streak of losers accumulates, the equity-floor gate freezes new entries and the per-ticket ratchet tries to salvage whatever profit is in the basket.

Deployment is EURUSD on M5 or H1 with a $100 account at 0.01-lot scaling (the LotSize input is a literal fixed lot, not a percentage of balance, so 1.0 means 1.0 standard lot — the user must scale it down to the broker's micro-lot step before live). The EA expects a low-spread ECN or no-dealing-desk feed (the 5-point ceiling and the 2x extreme-spike hard stop both assume sub-1.5-point typical spreads) and clean tick data (the iBars / iTime new-bar detection at the top of OnTick() will skip ticks until the bar count stabilises, which is correct for backtests and noisy for live under high-latency brokers). The London/NY session filter is off by default for forward-compatibility with 24-hour servers, but flipping UseSessionFilter to true and the three session toggles to taste confines entries to 08-21 GMT, with the 13-16 overlap the most active window. Above H1 the adaptive MA stops reacting to intraday volatility, so the strategy thins out into a slower trend-follower and the ratchet becomes the dominant profit mechanism — keep the timeframe at M5 for the design as written.

Strategy Deep Dive

On every new bar, four code-level calculators refresh seven 100-element arrays — adaptive MA, volatility, RSI, and four Heiken Ashi series — without ever allocating a native MT5 indicator handle; the "adaptive" MA is a plain SMA whose period is recomputed from the bar's high-low range relative to a twenty-bar average and clamped to the [5, 50] band. GetBuySignal() and GetSellSignal() are mirror images that each return a single boolean from a four-way AND chain (price vs adaptive MA, recent crossover OR strong candle body, volatility > 0.3 points), and GetConfirmationSignal() adds the Wilder RSI 30-70 corridor as a final gate. Three risk gates — IsMarketConditionsOK (spread < 5 points, drawdown < 10%, count < 5), IsPositionManagementOK (every open position at least 20 points in profit), and IsOptimalTradingSession (London 8-16 / NY 13-21 / overlap 13-16 GMT, with the tester short-circuit to true) — sit between the signal and the order ticket, and RequireToCheckForConfirmationBeforeAdding plus IsPositionDirectionProfitable tighten the same gates for pyramid entries. Every order opens with a 50-point stop and 100-point take profit (1:2) at the fixed LotSize input, and ManageDynamicStopLoss ratchets the stop tighter every 30 points of unrealized gain (with a 15-point buffer) using a per-ticket lastHighestProfit watermark that only moves up. The whole design runs on a single signal line and a single ratchet — no crossover/divergence sub-modes, no breakout/mean-reversion switches, no basket close — which is what makes this v1 the leanest cut of the family.

Entry Signal

A buy fires on a new bar when the working price (Heiken Ashi close or raw close, set by UseHeikenAshi) sits above the adaptive SMA, AND either a fresh cross happened on the last bar OR a strong candle with body larger than 50% of its range appeared, AND the latest volatility reading clears 0.3 points. Confirmation is gated by the Wilder RSI sitting in the 30-70 corridor; the equity drawdown is below 10%, open positions on the magic are below 5, and any existing same-direction positions are already at least 20 points in profit before a pyramid entry is allowed. Sells mirror every comparison.

Exit Signal

Exits are not signaled from the entry path — the strategy relies on the fixed 50-point stop and 100-point take profit that are attached to every ticket at open. The dynamic stop-loss ratchet can tighten the stop on a profitable position every 30 points of unrealized gain (with a 15-point buffer), but it can never loosen, so the position closes either at TP, at the original or ratcheted SL, or when a reverse-signal bar coincides with the basket being in profit. The session filter also has no exit-side logic; it gates entries only.

Stop Loss

Every ticket opens with a 50-point stop attached directly to the order (StopLossPoints * pointValue), and the watermark ratchet in ManageDynamicStopLoss() can tighten that stop every 30 points of unrealized gain (with a 15-point buffer) but never loosen it. The 10% MaxDrawdownPercent equity-floor gate is the global brake that freezes all new entries if the account has lost more than 10% of its starting balance — there is no per-basket hard close in this v1 file.

Take Profit

A fixed 100-point take profit is attached to every ticket at open (TakeProfitPoints * pointValue), giving a 1:2 reward-to-risk on the initial 50-point stop. The TP value on the ticket is preserved through the ratchet — the dynamic stop-lock only modifies the stop, never the TP — so a position that survives the ratchet will close at the original TP unless the broker fills the ratcheted stop first.

Best For

EURUSD M5 or H1 with a $100 minimum account at 0.01-lot scaling (the fixed LotSize input is a literal lot value, so 1.0 must be reduced to a micro-lot step before going live). Broker must be ECN / no-dealing-desk with sub-1.5-point typical spreads and clean tick data, since the 5-point MaxSpread ceiling and the 2x extreme-spike hard stop assume that regime. Session filter off by default (the strategy tester short-circuits it to true), but flipping UseSessionFilter to true with the three session toggles confines entries to London 8-16 GMT and New York 13-21 GMT, with the 13-16 overlap the most active window. Above H1 the adaptive MA stops reacting to intraday volatility, so keep the timeframe at M5 for the design as written; the 10% MaxDrawdownPercent is the load-bearing safety in the absence of any per-basket close.

Strategy Logic

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

Family: MultiIndicatorConfluence Magic: 22212045 Version: 2.00

BRIEF: Adaptive forex scalping EA combining adaptive moving average, RSI confirmation, Heiken Ashi, and volatility filter for entry signals, with dynamic profit locking and additional position management. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • UpdateAdaptiveIndicators()
  • CalculateAdaptiveVolatility()
  • CalculateAdaptiveMA()
  • CalculateRSI()
  • CalculateHeikenAshi()
  • CheckForEntry()
  • GetBuySignal()
  • GetSellSignal()
  • GetConfirmationSignal()
  • IsMarketConditionsOK()
  • IsPositionManagementOK()
  • ManagePositions()
  • ...and 9 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (35 total across 6 groups):

  • [=== BASIC SETTINGS ===] EnableTrading = true // Enable trading
  • [=== BASIC SETTINGS ===] EnableDebug = false // Enable debug logging
  • [=== BASIC SETTINGS ===] AllowBuys = true // Allow opening buy orders
  • [=== BASIC SETTINGS ===] AllowSells = true // Allow opening sell orders
  • [=== BASIC SETTINGS ===] LotSize = 1.0 // Fixed lot size
  • [=== BASIC SETTINGS ===] MagicNumber = 22212045 // Magic number
  • [=== BASIC SETTINGS ===] InpTradeComment = "Psgrowth.com Expert_12045" // Trade comment
  • [=== BASIC SETTINGS ===] Slippage = 3 // Slippage in points
  • [=== RISK MANAGEMENT ===] MaxSpread = 5.0 // Maximum spread in points
  • [=== RISK MANAGEMENT ===] MaxDrawdownPercent = 10.0 // Maximum drawdown percentage
  • [=== RISK MANAGEMENT ===] MaxRiskPerTrade = 2.0 // Maximum risk per trade %
  • [=== RISK MANAGEMENT ===] MaxOpenTrades = 5 // Maximum open trades
  • [=== RISK MANAGEMENT ===] StopLossPoints = 50.0 // Stop loss in points
  • [=== RISK MANAGEMENT ===] TakeProfitPoints = 100.0 // Take profit in points
  • [=== DYNAMIC PROFIT MANAGEMENT ===] EnableDynamicLockProfit = true // Enable dynamic profit locking
  • [=== DYNAMIC PROFIT MANAGEMENT ===] LockProfitEvery_X_Points = 30.0 // Step: every X points profit
  • [=== DYNAMIC PROFIT MANAGEMENT ===] LockMinusBuffer = 15.0 // Lock profit minus X point buffer
  • [=== DYNAMIC PROFIT MANAGEMENT ===] EnableDynamicProfitManagementDebug = false // Enable debug logging for dynamic profit management
  • [=== Additional POSITION MANAGEMENT ===] AllowOnlyProfitableAdditions = true // Only allow adding positions if existing trades are profitable
  • [=== Additional POSITION MANAGEMENT ===] MinProfitInPointsPerTradeToAdd = 20.0 // Minimum profit required per existing trade in points
  • [=== Additional POSITION MANAGEMENT ===] RequireToCheckForConfirmationBeforeAdding = true // Require to check active confirmation before adding new positions
  • [=== Additional POSITION MANAGEMENT ===] EnableAdditionalPositionManagementDebug = false // Enable debug logging for additional position management
  • [=== ADAPTIVE INDICATORS ===] AdaptiveMA_Period = 14 // Adaptive MA base period
  • [=== ADAPTIVE INDICATORS ===] AdaptiveMA_Sensitivity = 2.0 // Adaptive sensitivity multiplier
  • [=== ADAPTIVE INDICATORS ===] ConfirmationRSI_Period = 14 // Confirmation RSI period
  • [=== ADAPTIVE INDICATORS ===] RSI_Oversold = 30.0 // RSI oversold level
  • [=== ADAPTIVE INDICATORS ===] RSI_Overbought = 70.0 // RSI overbought level
  • [=== ADAPTIVE INDICATORS ===] UseHeikenAshi = true // Use Heiken Ashi for smoother signals
  • [=== ADAPTIVE INDICATORS ===] UseVolatilityFilter = true // Use volatility filter for entries
  • [=== ADAPTIVE INDICATORS ===] VolatilityThreshold = 0.3 // Minimum volatility threshold in points
  • [=== ADAPTIVE INDICATORS ===] EnableIndicatorDebug = false // Enable indicator debug logging
  • [=== SESSION FILTER ===] UseSessionFilter = false // Use trading session filter
  • [=== SESSION FILTER ===] TradeLondonSession = true // Trade during London session (8-16 GMT)
  • [=== SESSION FILTER ===] TradeNewYorkSession = true // Trade during New York session (13-21 GMT)
  • [=== SESSION FILTER ===] TradeOverlapSession = true // Trade during London/NY overlap (13-16 GMT)
Pseudocode
// Pipsgrowth EX12045 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Adaptive forex scalping EA combining adaptive moving average, RSI confirmation, Heiken Ashi, and volatility filter for entry signals, with dynamic profit locking and additional position 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

Optimized Brokers:
ExnessIC Markets
Optimized Symbols:
EURUSD
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
EnableTradingtrueEnable trading
EnableDebugfalseEnable debug logging
AllowBuystrueAllow opening buy orders
AllowSellstrueAllow opening sell orders
LotSize1.0Fixed lot size
MagicNumber22212045Magic number
InpTradeComment"Psgrowth.com Expert_12045"Trade comment
Slippage3Slippage in points
MaxSpread5.0Maximum spread in points
MaxDrawdownPercent10.0Maximum drawdown percentage
MaxRiskPerTrade2.0Maximum risk per trade %
MaxOpenTrades5Maximum open trades
StopLossPoints50.0Stop loss in points
TakeProfitPoints100.0Take profit in points
EnableDynamicLockProfittrueEnable dynamic profit locking
LockProfitEvery_X_Points30.0Step: every X points profit
LockMinusBuffer15.0Lock profit minus X point buffer
EnableDynamicProfitManagementDebugfalseEnable debug logging for dynamic profit management
AllowOnlyProfitableAdditionstrueOnly allow adding positions if existing trades are profitable
MinProfitInPointsPerTradeToAdd20.0Minimum profit required per existing trade in points
RequireToCheckForConfirmationBeforeAddingtrueRequire to check active confirmation before adding new positions
EnableAdditionalPositionManagementDebugfalseEnable debug logging for additional position management
AdaptiveMA_Period14Adaptive MA base period
AdaptiveMA_Sensitivity2.0Adaptive sensitivity multiplier
ConfirmationRSI_Period14Confirmation RSI period
RSI_Oversold30.0RSI oversold level
RSI_Overbought70.0RSI overbought level
UseHeikenAshitrueUse Heiken Ashi for smoother signals
UseVolatilityFiltertrueUse volatility filter for entries
VolatilityThreshold0.3Minimum volatility threshold in points
EnableIndicatorDebugfalseEnable indicator debug logging
UseSessionFilterfalseUse trading session filter
TradeLondonSessiontrueTrade during London session (8-16 GMT)
TradeNewYorkSessiontrueTrade during New York session (13-21 GMT)
TradeOverlapSessiontrueTrade during London/NY overlap (13-16 GMT)
Source Code (.mq5)Open Source
Pipsgrowth_com_EX12045.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX12045 EURUSD_v1 — adaptive scalping EA with AMA, RSI, Heiken Ashi and volatility filter, full 12-layer stack."

#include <Trade/Trade.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/AccountInfo.mqh>

//--- Global objects
CTrade         trade;
CPositionInfo  position;
CAccountInfo   account;

//--- Input parameters
input group "=== BASIC SETTINGS ==="
input bool     EnableTrading = true;                    // Enable trading
input bool     EnableDebug = false;                     // Enable debug logging
input bool     AllowBuys = true;                        // Allow opening buy orders
input bool     AllowSells = true;                       // Allow opening sell orders
input double   LotSize = 1.0;                          // Fixed lot size
input int      MagicNumber = 22212045;                 // Magic number
input string   InpTradeComment = "Psgrowth.com Expert_12045"; // Trade comment
input int      Slippage = 3;                           // Slippage in points

input group "=== RISK MANAGEMENT ==="
input double   MaxSpread = 5.0;                        // Maximum spread in points
input double   MaxDrawdownPercent = 10.0;              // Maximum drawdown percentage
input double   MaxRiskPerTrade = 2.0;                  // Maximum risk per trade %
input int      MaxOpenTrades = 5;                      // Maximum open trades
input double   StopLossPoints = 50.0;                 // Stop loss in points
input double   TakeProfitPoints = 100.0;               // Take profit in points

input group "=== DYNAMIC PROFIT MANAGEMENT ==="
input bool     EnableDynamicLockProfit = true;         // Enable dynamic profit locking
input double   LockProfitEvery_X_Points = 30.0;        // Step: every X points profit
input double   LockMinusBuffer = 15.0;                 // Lock profit minus X point buffer
input bool     EnableDynamicProfitManagementDebug = false; // Enable debug logging for dynamic profit management

input group "=== Additional POSITION MANAGEMENT ==="
input bool     AllowOnlyProfitableAdditions = true;    // Only allow adding positions if existing trades are profitable
input double   MinProfitInPointsPerTradeToAdd = 20.0;  // Minimum profit required per existing trade in points
input bool     RequireToCheckForConfirmationBeforeAdding = true; // Require to check active confirmation before adding new positions
input bool     EnableAdditionalPositionManagementDebug = false; // Enable debug logging for additional position management

input group "=== ADAPTIVE INDICATORS ==="
input int      AdaptiveMA_Period = 14;                 // Adaptive MA base period
input double   AdaptiveMA_Sensitivity = 2.0;           // Adaptive sensitivity multiplier
input int      ConfirmationRSI_Period = 14;            // Confirmation RSI period
input double   RSI_Oversold = 30.0;                    // RSI oversold level
input double   RSI_Overbought = 70.0;                  // RSI overbought level
input bool     UseHeikenAshi = true;                   // Use Heiken Ashi for smoother signals
input bool     UseVolatilityFilter = true;             // Use volatility filter for entries
input double   VolatilityThreshold = 0.3;              // Minimum volatility threshold in points
input bool     EnableIndicatorDebug = false;           // Enable indicator debug logging

input group "=== SESSION FILTER ==="
input bool     UseSessionFilter = false;               // Use trading session filter
input bool     TradeLondonSession = true;              // Trade during London session (8-16 GMT)

Full source code available on download

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

Tags:ex12045multiindicatorconfluencepipsgrowthfreemt5eurusd

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_EX12045.mq5
File Size45.0 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M5H1
Currency Pairs
EURUSD
Min. Deposit$100