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.
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.
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.
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.
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.
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
MT5indicators
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):
- [===
BASICSETTINGS===]EnableTrading=true// Enable trading - [===
BASICSETTINGS===]EnableDebug=false// Enable debug logging - [===
BASICSETTINGS===]AllowBuys=true// Allow opening buy orders - [===
BASICSETTINGS===]AllowSells=true// Allow opening sell orders - [===
BASICSETTINGS===]LotSize=1.0// Fixed lot size - [===
BASICSETTINGS===]MagicNumber=22212045// Magic number - [===
BASICSETTINGS===]InpTradeComment= "Psgrowth.com Expert_12045" // Trade comment - [===
BASICSETTINGS===] Slippage = 3 // Slippage in points - [===
RISKMANAGEMENT===]MaxSpread=5.0// Maximum spread in points - [===
RISKMANAGEMENT===]MaxDrawdownPercent=10.0// Maximum drawdown percentage - [===
RISKMANAGEMENT===]MaxRiskPerTrade=2.0// Maximum risk per trade % - [===
RISKMANAGEMENT===]MaxOpenTrades= 5 // Maximum open trades - [===
RISKMANAGEMENT===]StopLossPoints=50.0// Stop loss in points - [===
RISKMANAGEMENT===]TakeProfitPoints=100.0// Take profit in points - [===
DYNAMICPROFITMANAGEMENT===]EnableDynamicLockProfit=true// Enable dynamic profit locking - [===
DYNAMICPROFITMANAGEMENT===]LockProfitEvery_X_Points=30.0// Step: every X points profit - [===
DYNAMICPROFITMANAGEMENT===]LockMinusBuffer=15.0// Lock profit minus X point buffer - [===
DYNAMICPROFITMANAGEMENT===]EnableDynamicProfitManagementDebug=false// Enable debug logging for dynamic profit management - [=== Additional
POSITIONMANAGEMENT===]AllowOnlyProfitableAdditions=true// Only allow adding positions if existing trades are profitable - [=== Additional
POSITIONMANAGEMENT===]MinProfitInPointsPerTradeToAdd=20.0// Minimum profit required per existing trade in points - [=== Additional
POSITIONMANAGEMENT===]RequireToCheckForConfirmationBeforeAdding=true// Require to check active confirmation before adding new positions - [=== Additional
POSITIONMANAGEMENT===]EnableAdditionalPositionManagementDebug=false// Enable debug logging for additional position management - [===
ADAPTIVEINDICATORS===]AdaptiveMA_Period= 14 // Adaptive MA base period - [===
ADAPTIVEINDICATORS===]AdaptiveMA_Sensitivity=2.0// Adaptive sensitivity multiplier - [===
ADAPTIVEINDICATORS===]ConfirmationRSI_Period= 14 // ConfirmationRSIperiod - [===
ADAPTIVEINDICATORS===] RSI_Oversold =30.0//RSIoversoldlevel - [===
ADAPTIVEINDICATORS===] RSI_Overbought =70.0//RSIoverboughtlevel - [===
ADAPTIVEINDICATORS===]UseHeikenAshi=true// Use Heiken Ashi for smoother signals - [===
ADAPTIVEINDICATORS===]UseVolatilityFilter=true// Use volatility filter for entries - [===
ADAPTIVEINDICATORS===]VolatilityThreshold=0.3// Minimum volatility threshold in points - [===
ADAPTIVEINDICATORS===]EnableIndicatorDebug=false// Enable indicator debug logging - [===
SESSIONFILTER===]UseSessionFilter=false// Use trading session filter - [===
SESSIONFILTER===]TradeLondonSession=true// Trade during London session (8-16GMT) - [===
SESSIONFILTER===]TradeNewYorkSession=true// Trade during New York session (13-21GMT) - [===
SESSIONFILTER===]TradeOverlapSession=true// Trade during London/NY overlap (13-16GMT)
// 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
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 |
|---|---|---|
| EnableTrading | true | Enable trading |
| EnableDebug | false | Enable debug logging |
| AllowBuys | true | Allow opening buy orders |
| AllowSells | true | Allow opening sell orders |
| LotSize | 1.0 | Fixed lot size |
| MagicNumber | 22212045 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12045" | Trade comment |
| Slippage | 3 | Slippage in points |
| MaxSpread | 5.0 | Maximum spread in points |
| MaxDrawdownPercent | 10.0 | Maximum drawdown percentage |
| MaxRiskPerTrade | 2.0 | Maximum risk per trade % |
| MaxOpenTrades | 5 | Maximum open trades |
| StopLossPoints | 50.0 | Stop loss in points |
| TakeProfitPoints | 100.0 | Take profit in points |
| EnableDynamicLockProfit | true | Enable dynamic profit locking |
| LockProfitEvery_X_Points | 30.0 | Step: every X points profit |
| LockMinusBuffer | 15.0 | Lock profit minus X point buffer |
| EnableDynamicProfitManagementDebug | false | Enable debug logging for dynamic profit management |
| AllowOnlyProfitableAdditions | true | Only allow adding positions if existing trades are profitable |
| MinProfitInPointsPerTradeToAdd | 20.0 | Minimum profit required per existing trade in points |
| RequireToCheckForConfirmationBeforeAdding | true | Require to check active confirmation before adding new positions |
| EnableAdditionalPositionManagementDebug | false | Enable debug logging for additional position management |
| AdaptiveMA_Period | 14 | Adaptive MA base period |
| AdaptiveMA_Sensitivity | 2.0 | Adaptive sensitivity multiplier |
| ConfirmationRSI_Period | 14 | Confirmation RSI period |
| RSI_Oversold | 30.0 | RSI oversold level |
| RSI_Overbought | 70.0 | RSI overbought level |
| UseHeikenAshi | true | Use Heiken Ashi for smoother signals |
| UseVolatilityFilter | true | Use volatility filter for entries |
| VolatilityThreshold | 0.3 | Minimum volatility threshold in points |
| EnableIndicatorDebug | false | Enable indicator debug logging |
| UseSessionFilter | false | Use trading session filter |
| TradeLondonSession | true | Trade during London session (8-16 GMT) |
| TradeNewYorkSession | true | Trade during New York session (13-21 GMT) |
| TradeOverlapSession | true | Trade during London/NY overlap (13-16 GMT) |
#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.
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.