Pipsgrowth EX12040 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · EURUSD · M5, H1
Pipsgrowth.com EX12040 EURUSD_1_4 — Adaptive AMA+RSI+ATR+BB+MACD+Heiken Ashi scalper, full 12-layer stack.
Overview
Pipsgrowth EX12040 MultiIndicatorConfluence is the four-handle build of the EX12 confluence family — every indicator the platform offers gets its own native i* handle wired into both entry and confirmation, so the EA's signal stack fires on AMA direction, candle shape, ATR-derived volatility, Bollinger Band position, MACD histogram/signal-line state, RSI crossover, and Heiken Ashi trend, all gated through a five-way AND combiner before a confirmation layer re-checks the same stack on a different logical footing. The .mq5 opens with iRSI(_Symbol, PERIOD_CURRENT, RSI_Period, PRICE_CLOSE), iATR(_Symbol, PERIOD_CURRENT, ATR_Period), iBands(_Symbol, PERIOD_CURRENT, BB_Period, (int)BB_Deviation, 0, PRICE_CLOSE), and iMACD(_Symbol, PERIOD_CURRENT, MACD_FastEMA, MACD_SlowEMA, MACD_SignalPeriod, PRICE_CLOSE) — four real handles, no IndicatorsTotal-style abstraction, plus manually-populated arrays for the volatility-windowed 'adaptive MA' that the header still brands as AMA (period 5–50 depending on the rolling volRatio, base 14, sensitivity 2.0) and the recursive Heiken Ashi buffers that start haOpen[0]=(O+C)/2 then iterate haOpen[i]=(haOpen[i-1]+haClose[i-1])/2 for the rest. Each handle's Calculate* helper copies exactly three bars from its buffer via CopyBuffer(handle, 0, 0, 3, ...) — that three-bar window is the only state the rest of the EA ever reads, and it is what the divergence branch leans on (5-bar price/RSI lookback for divergence). Both CalculateRSI and CalculateATR ship with manual fallback loops in case the handle ever comes back INVALID_HANDLE after init, which is defensive but never actually triggers in normal operation.
The entry side runs once per new bar from OnTick(). GetBuySignal starts with five AND-gated conditions: priceAboveMA (close > adaptiveMA[0]), bullishCandle (close > open), volatilityOK (ATR-based, threshold = ATR_VolatilityMultiplier * VolatilityThreshold * pointValue, default 0.3 * pointValue on M5/H1 EURUSD), bbOK (Bollinger band position depends on which of the two mutually exclusive modes is active — BB_UseBreakoutStrategy=true default means long on close > bbUpper[0], short on close < bbLower[0]; flipping BB_UseMeanReversionStrategy=true swaps the polarity so long fires on close < bbLower[0] and short on close > bbUpper[0]), and macdOK. The macdOK branch is its own three-way OR: if MACD_UseHistogramCrossover AND MACD_UseSignalLineCrossover are both true (default), macdOK = (histogramCross || signalLineCross) where histogramCross = macdHistogram[1] < 0 && macdHistogram[0] > 0 (or the inverse for sells) and signalLineCross = macdMain[1] < macdSignal[1] && macdMain[0] > macdSignal[0]. With only one MACD crossover method on, the OR collapses to that single check. After the five-way AND, the function optionally ANDs in rsiOK (RSI crossing up through oversold 30 for buy, down through overbought 70 for sell, default period 14) and haBullish (haClose[0] > haOpen[0]) depending on the UseRSIforEntrySignals and UseHeikenAshi toggles. GetSellSignal mirrors it for shorts with the same structure and inverted thresholds.
The confirmation layer — GetConfirmationSignal() — runs the same stack a second time, but with a different logical flavor. It computes rsiNotInExtremeZones (RSI between 30 and 70), rsiCrossoverConfirm, rsiDivergenceConfirm (5-bar lookback: price low at bar 1 vs bar 5 vs RSI value at the same offsets), volumeConfirm (always true because retail forex rarely has tick volume that means anything), haConfirm (two consecutive bullish or bearish HA candles — a trend-persistence check, not just the current bar), bbConfirm, and macdConfirm. The bbConfirm sub-routine computes priceToBBUpperRatio = (price − bbMiddle) / (bbUpper − bbMiddle) and priceToBBLowerRatio = (bbMiddle − price) / (bbMiddle − bbLower), passing when either is greater than 0.8 in breakout mode (price in the outer 20% of the band envelope) or when price sits in the inner half of the band envelope in mean-reversion mode. The macdConfirm sub-routine is a three-way OR of macdBullish (main line > 0 OR main line trending up over the last 3 bars), macdBearish (main line < 0 OR trending down), and histogramTrendOK (histogram positive and growing, or negative and shrinking). The final combiner is the familiar four-branch selector: when both RSI_UseCrossoverSignals and RSI_UseDivergenceSignals are on, the function accepts (crossover OR divergence) AND volume AND bbConfirm AND haConfirm AND macdConfirm; with only crossover on, it requires crossover AND volume AND bbConfirm AND haConfirm AND macdConfirm; with only divergence on, divergence AND volume AND bbConfirm AND haConfirm AND macdConfirm; with neither on, rsiNotInExtremeZones AND volume AND bbConfirm AND haConfirm AND macdConfirm. The BB and HA and MACD confirms are the constant backbone that the RSI branch toggles on top of.
Execution logic is strictly pyramid-into-winners. Before the first ticket in a direction, IsPositionManagementOK() short-circuits to true (no existing positions to evaluate). Once a ticket is open, the next same-direction entry requires confirmation to pass AND IsPositionDirectionProfitable(POSITION_TYPE_BUY/SELL) to return true, meaning every open position in that direction must currently be at least MinProfitInPointsPerTradeToAdd = 20 points in the green. MaxOpenTrades = 5 caps the per-direction stack, and RequireToCheckForConfirmationBeforeAdding = true means additional tickets must also pass the same gate that the first one did. There is no opposite-signal exit path — both directions can coexist (5 buys and 5 sells simultaneously is legal), and the EA never closes a winner because a counter-signal appeared. Initial SL = StopLossPoints * pointValue = 50 points, initial TP = TakeProfitPoints * pointValue = 100 points, set on the order ticket at submission. The ManagePositions() loop runs every tick, calling ManageDynamicStopLoss() per open position. That function tracks lastHighestProfit[] per position index, then on each tick computes lockSteps = floor(peak / LockProfitEvery_X_Points) = floor(peak / 30) and newSL = priceOpen + (lockSteps * 30 − LockMinusBuffer) * pointValue = priceOpen + (lockSteps * 30 − 15) * pointValue for buys, mirrored for sells. The 'shouldModify' guard only fires when the new SL is strictly better than the existing one (newSL > currentSL for buys, newSL < currentSL for sells, with the empty-SL zero-check on the sell side), so the stop ratchets upward but never loosens.
The safety stack is dense. IsMarketConditionsOK() rejects any tick where current spread exceeds MaxSpread = 5.0 points (5x spike override at 25 points). It computes drawdownPercent = 100 * (1 − equity/balance) and blocks new entries past MaxDrawdownPercent = 10.0. The ATR volatility gate is double-armed: the entry logic requires atrBuffer[0] > 0.3 * pointValue to consider a trade, and IsMarketConditionsOK has a separate atrBuffer[0] < minATR rejection so the EA flat-out refuses to fire when volatility collapses. The session filter lives in IsOptimalTradingSession() and is opt-in via UseSessionFilter = false default — when off, it returns true unconditionally, and a built-in isTester flag also short-circuits to true so the strategy tester doesn't reject candles for time reasons. When enabled, it accepts London (8–16 GMT), New York (13–21 GMT), and the London/New York overlap (13–16 GMT) with three independent booleans. Slippage = 3 points. LotSize is a fixed input defaulting to 1.0 (MaxRiskPerTrade is declared but not enforced by visible sizing code — this is a constant-lot EA, not a risk-percent sizer). All closing and modifying operations route through three retry helpers (TryClose_EX12040, TryClosePartial_EX12040, TryModify_EX12040), each of which attempts the operation up to 3 times with 200 ms sleep on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED (100 ms for modify) and breaks on any other return code — this is what keeps the EA from stalling on flaky requotes during London open.
In the backtest environment, this is the EA to run if you want to see how the full confluence stack behaves. The default config is BB breakout + MACD both modes + RSI crossover + Heiken Ashi on, which is the most aggressive signal combination the codebase supports. Tighten it by flipping BB_UseMeanReversionStrategy for range trading, or disable UseMACD_ForEntrySignals to drop the stack back to a 4-way AND if you want to compare the marginal value of the MACD branch. The dynamic stop-lock makes this a reasonable candidate for trend days on M5 EURUSD with the London session filter enabled, and the 1:2 initial RR (50/100) gives every trade room to breathe before the ratchet kicks in at +30 points. For live deployment, run it on a low-spread ECN or RAW-spread broker (IC Markets, Pepperstone, Exness) with at least $100 starting balance and 0.01 lot sizing scaled up only after the spread filter and drawdown cap prove themselves on your data. The strategy tester will paint a cleaner picture than live because the session gate is disabled there — when you turn it on, expect the trade count to drop sharply and the per-trade quality to improve. The EA is built strictly for EURUSD (the only pair the indicator stack is tuned for in this build) and works on M5 and H1 charts — anything below M5 will start hitting the ATR volatility threshold constantly, and anything above H1 makes the 5-bar divergence check look at stale data.
Strategy Deep Dive
On every tick the EA updates the four native indicator handles — iRSI(14), iATR(14), iBands(20, 2.0), and iMACD(12, 26, 9) — plus the manually-populated adaptive MA, Heiken Ashi, and BB arrays, but only fires CheckForEntry when a new bar is detected. The new-bar gate then walks IsMarketConditionsOK (spread ≤ 5pt, drawdown ≤ 10%, ATR above 0.3 * pointValue), IsPositionManagementOK (when there are existing positions, every open position in the same direction must be at least 20 points in profit), and IsOptimalTradingSession (off by default, opt-in to London 8-16 / NY 13-21 / overlap 13-16 GMT, and short-circuited to true in the strategy tester). Only then do GetBuySignal and GetSellSignal run, and both have to AND-pass five conditions (price vs MA, candle direction, volatility, Bollinger band position, MACD state) plus the optional RSI crossover and Heiken Ashi gates. A second pass through GetConfirmationSignal re-validates the same stack with a four-branch combiner (crossover+divergence / crossover-only / divergence-only / RSI-in-range) AND'd against bbConfirm, haConfirm, and macdConfirm before any trade.Buy or trade.Sell fires. Position management runs every tick via ManagePositions → ManageDynamicStopLoss, which tracks the per-ticket lastHighestProfit watermark and steps the stop up every 30 points of peak profit, minus a 15-point buffer, never loosening. The pyramid-into-winners logic caps same-direction exposure at MaxOpenTrades = 5 and requires every additional ticket to clear the same confirmation gate plus the directional profitability check.
Long entries require five AND-gated conditions: close above the volatility-windowed adaptive MA, a bullish current candle (close > open), ATR above the volatility threshold (0.3 * pointValue), a Bollinger band position trigger (long on close > bbUpper in breakout mode, or long on close < bbLower in mean-reversion mode), and an MACD condition (histogram crossing above zero OR MACD main line crossing above signal line). When UseRSIforEntrySignals is on (default), an additional RSI crossover up through 30 is required; when UseHeikenAshi is on, haClose > haOpen on the current bar is required. Shorts mirror the same stack with inverted thresholds.
Exits come from initial TakeProfit = 100 points hit, or from the ratchet-stop being run over by price. There is no opposite-signal exit path and no time-based exit — when a position hits the 1:2 RR target the order closes itself, when the dynamic stop-lock at priceOpen + (lockSteps * 30 − 15) * pointValue (or mirrored for sells) gets hit, the order closes itself, and the EA never manually closes a winner because a counter-signal appeared. Both directions can coexist at the MaxOpenTrades=5 per-direction cap simultaneously.
Each order gets a fixed 50-point stop (StopLossPoints * pointValue, with pointValue adjusted ×10 for 5/3-digit brokers) set on the ticket at submission. The ManageDynamicStopLoss function then ratchets the stop upward as profit grows, computing lockSteps = floor(peak / 30) and newSL = priceOpen + (lockSteps * 30 − 15) * pointValue for buys (mirrored for sells), only ever tightening — the stop never loosens once it moves.
Each order gets a fixed 100-point take-profit (TakeProfitPoints * pointValue) set on the ticket at submission — a 1:2 risk-to-reward ratio against the 50-point initial stop. The TP does not move; the dynamic ratchet acts on the stop side, never the target side. There is no basket TP or partial-TP ladder — TP is the TP, hit it and the order is done.
EURUSD on M5 or H1 charts only — the indicator stack is tuned for that pair and these timeframes. Minimum recommended balance is $100 with 0.01 lot sizing scaled up only after the spread filter and 10% drawdown cap prove themselves in your environment. Run on a low-spread ECN or RAW-spread broker (IC Markets, Pepperstone, Exness) where typical EURUSD spread stays inside the 5-point MaxSpread default. The session filter is opt-in; turn it on with TradeLondonSession=true (and TradeOverlapSession=true for the volatility window) for London-only operation, leave it off for full-week coverage. The 1:2 initial RR and 50/100 stop/target make this a trend-day strategy, and the 5-position per-direction cap with the directional profitability gate means it scales exposure into winners rather than firing repeatedly into chop.
Strategy Logic
Pipsgrowth EX12040 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212040
Version: 2.00
BRIEF:
Adaptive forex scalping EA combining AMA, RSI, ATR, Bollinger Bands, MACD and Heiken Ashi confluence. Supports BB breakout/mean-reversion, MACD histogram and signal-line cross, dynamic profit locking, additional position management, session and volatility filters. 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()CalculateATR()CalculateBollingerBands()CalculateMACD()CheckForEntry()GetBuySignal()GetSellSignal()GetConfirmationSignal()- ...and 12 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (62 total across 11 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 (0.01,0.01,2.0) - [=== Basic Settings ===]
MagicNumber=22212040// Magic number - [=== Basic Settings ===]
InpTradeComment= "Psgrowth.com Expert_12040" // Trade comment - [=== Basic Settings ===] Slippage = 3 // Slippage in points (1,1,10)
- [=== Risk Management ===]
MaxSpread=5.0// Maximum spread in points (1.0,0.5,10.0) - [=== Risk Management ===]
MaxDrawdownPercent=10.0// Maximum drawdown percentage (5.0,1.0,20.0) - [=== Risk Management ===]
MaxRiskPerTrade=2.0// Maximum risk per trade % (0.5,0.5,5.0) - [=== Risk Management ===]
MaxOpenTrades= 5 // Maximum open trades (1,1,10) - [=== Risk Management ===]
StopLossPoints=50.0// Stop loss in points (20.0,5.0,150.0) - [=== Risk Management ===]
TakeProfitPoints=100.0// Take profit in points (40.0,10.0,300.0) - [=== Dynamic Profit Management ===]
EnableDynamicLockProfit=true// Enable dynamic profit locking - [=== Dynamic Profit Management ===]
LockProfitEvery_X_Points=30.0// Step: every X points profit (10.0,5.0,50.0) - [=== Dynamic Profit Management ===]
LockMinusBuffer=15.0// Lock profit minus X point buffer (5.0,2.0,30.0) - [=== 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 (10.0,5.0,50.0) - [=== 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 ===]
EnableIndicatorDebug=false// Enable debug logging for indicators - [=== Adaptive Indicators ===]
UseAMAforEntrySignals=true// UseAMAfor entry signals - [=== Adaptive Indicators ===]
UseAMAforConfirmation=true// UseAMAfor confirmation - [=== Adaptive Indicators ===]
UseRSIforEntrySignals=true// UseRSIfor entry signals - [=== Adaptive Indicators ===]
UseRSIforConfirmation=true// UseRSIfor confirmation - [=== Adaptive Indicators ===]
AdaptiveMA_Period= 14 // Adaptive MA base period (8,2,30) - [=== Adaptive Indicators ===]
AdaptiveMA_Sensitivity=2.0// Adaptive sensitivity multiplier (1.0,0.5,5.0) - [===
RSISettings ===] RSI_Period = 14 //RSIperiod (7,1,21) - [===
RSISettings ===] RSI_Oversold =30.0//RSIoversoldlevel(20.0,1.0,40.0) - [===
RSISettings ===] RSI_Overbought =70.0//RSIoverboughtlevel(60.0,1.0,80.0) - [===
RSISettings ===] RSI_UseCrossoverSignals =true// UseRSIcrossover signals - [===
RSISettings ===] RSI_UseDivergenceSignals =false// UseRSIdivergence signals - [===
RSISettings ===]EnableRSI_Debug=false// EnableRSIdebug logging - [===
ATRSettings ===] ATR_Period = 14 //ATRperiod (7,1,28) - [===
ATRSettings ===]UseATRforVolatilityFilter=true// UseATRfor volatility filtering - [===
ATRSettings ===] ATR_VolatilityMultiplier =1.0//ATRvolatility multiplier (0.5,0.1,3.0) - [===
ATRSettings ===]EnableATR_Debug=false// EnableATRdebug logging - [=== Bollinger Bands Settings ===] BB_Period = 20 // Bollinger Bands period (10,5,50)
- [=== Bollinger Bands Settings ===] BB_Deviation =
2.0// Standard deviation multiplier (1.0,0.1,3.0) - [=== Bollinger Bands Settings ===]
UseBBforEntrySignals=true// Use Bollinger Bands for entry signals - [=== Bollinger Bands Settings ===]
UseBBforConfirmation=true// Use Bollinger Bands for confirmation - [=== Bollinger Bands Settings ===] BB_UseBreakoutStrategy =
true// Use breakout strategy - [=== Bollinger Bands Settings ===] BB_UseMeanReversionStrategy =
false// Use mean reversion strategy - [=== Bollinger Bands Settings ===]
EnableBB_Debug=false// Enable Bollinger Bands debug logging - [===
MACDSettings ===] MACD_FastEMA = 12 //MACDFastEMAperiod (8,1,24) - [===
MACDSettings ===] MACD_SlowEMA = 26 //MACDSlowEMAperiod (16,2,48) - [===
MACDSettings ===] MACD_SignalPeriod = 9 //MACDSignal line period (5,1,18) - [===
MACDSettings ===]UseMACD_ForEntrySignals=true// UseMACDfor entry signals - [===
MACDSettings ===]UseMACD_ForConfirmation=true// UseMACDfor confirmation - [===
MACDSettings ===] MACD_UseHistogramCrossover =true// UseMACDhistogram crossover for signals - [===
MACDSettings ===] MACD_UseSignalLineCrossover =true// UseMACDsignal line crossover for signals - [===
MACDSettings ===]EnableMACD_Debug=false// EnableMACDdebug logging - [=== Additional Indicators ===]
UseHeikenAshi=true// Use Heiken Ashi for entry signals - [=== Additional Indicators ===]
UseHeikenAshiForConfirmation=true// Use Heiken Ashi for confirmation - [=== Additional Indicators ===]
UseVolatilityFilter=true// Use volatility filter for entries - [=== Additional Indicators ===]
VolatilityThreshold=0.3// Minimum volatility threshold in points (0.1,0.1,1.0) - [=== Session Filter ===]
UseSessionFilter=false// Use trading session filter - [=== Session Filter ===]
TradeLondonSession=true// Trade during London session (8-16GMT) - [=== Session Filter ===]
TradeNewYorkSession=true// Trade during New York session (13-21GMT) - [=== Session Filter ===]
TradeOverlapSession=true// Trade during London/NY overlap (13-16GMT)
// Pipsgrowth EX12040 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Adaptive forex scalping EA combining AMA, RSI, ATR, Bollinger Bands, MACD and Heiken Ashi confluence. Supports BB breakout/mean-reversion, MACD histogram and signal-line cross, dynamic profit locking, additional position management, session and volatility filters. 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 (0.01,0.01,2.0) |
| MagicNumber | 22212040 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12040" | Trade comment |
| Slippage | 3 | Slippage in points (1,1,10) |
| MaxSpread | 5.0 | Maximum spread in points (1.0,0.5,10.0) |
| MaxDrawdownPercent | 10.0 | Maximum drawdown percentage (5.0,1.0,20.0) |
| MaxRiskPerTrade | 2.0 | Maximum risk per trade % (0.5,0.5,5.0) |
| MaxOpenTrades | 5 | Maximum open trades (1,1,10) |
| StopLossPoints | 50.0 | Stop loss in points (20.0,5.0,150.0) |
| TakeProfitPoints | 100.0 | Take profit in points (40.0,10.0,300.0) |
| EnableDynamicLockProfit | true | Enable dynamic profit locking |
| LockProfitEvery_X_Points | 30.0 | Step: every X points profit (10.0,5.0,50.0) |
| LockMinusBuffer | 15.0 | Lock profit minus X point buffer (5.0,2.0,30.0) |
| 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 (10.0,5.0,50.0) |
| RequireToCheckForConfirmationBeforeAdding | true | Require to check active confirmation before adding new positions |
| EnableAdditionalPositionManagementDebug | false | Enable debug logging for additional position management |
| EnableIndicatorDebug | false | Enable debug logging for indicators |
| UseAMAforEntrySignals | true | Use AMA for entry signals |
| UseAMAforConfirmation | true | Use AMA for confirmation |
| UseRSIforEntrySignals | true | Use RSI for entry signals |
| UseRSIforConfirmation | true | Use RSI for confirmation |
| AdaptiveMA_Period | 14 | Adaptive MA base period (8,2,30) |
| AdaptiveMA_Sensitivity | 2.0 | Adaptive sensitivity multiplier (1.0,0.5,5.0) |
| RSI_Period | 14 | RSI period (7,1,21) |
| RSI_Oversold | 30.0 | RSI oversold level (20.0,1.0,40.0) |
| RSI_Overbought | 70.0 | RSI overbought level (60.0,1.0,80.0) |
| RSI_UseCrossoverSignals | true | Use RSI crossover signals |
| RSI_UseDivergenceSignals | false | Use RSI divergence signals |
| EnableRSI_Debug | false | Enable RSI debug logging |
| ATR_Period | 14 | ATR period (7,1,28) |
| UseATRforVolatilityFilter | true | Use ATR for volatility filtering |
| ATR_VolatilityMultiplier | 1.0 | ATR volatility multiplier (0.5,0.1,3.0) |
| EnableATR_Debug | false | Enable ATR debug logging |
| BB_Period | 20 | Bollinger Bands period (10,5,50) |
| BB_Deviation | 2.0 | Standard deviation multiplier (1.0,0.1,3.0) |
| UseBBforEntrySignals | true | Use Bollinger Bands for entry signals |
| UseBBforConfirmation | true | Use Bollinger Bands for confirmation |
| BB_UseBreakoutStrategy | true | Use breakout strategy |
| BB_UseMeanReversionStrategy | false | Use mean reversion strategy |
| EnableBB_Debug | false | Enable Bollinger Bands debug logging |
| MACD_FastEMA | 12 | MACD Fast EMA period (8,1,24) |
| MACD_SlowEMA | 26 | MACD Slow EMA period (16,2,48) |
| MACD_SignalPeriod | 9 | MACD Signal line period (5,1,18) |
| UseMACD_ForEntrySignals | true | Use MACD for entry signals |
| UseMACD_ForConfirmation | true | Use MACD for confirmation |
| MACD_UseHistogramCrossover | true | Use MACD histogram crossover for signals |
| MACD_UseSignalLineCrossover | true | Use MACD signal line crossover for signals |
| EnableMACD_Debug | false | Enable MACD debug logging |
| UseHeikenAshi | true | Use Heiken Ashi for entry signals |
| UseHeikenAshiForConfirmation | true | Use Heiken Ashi for confirmation |
| UseVolatilityFilter | true | Use volatility filter for entries |
| VolatilityThreshold | 0.3 | Minimum volatility threshold in points (0.1,0.1,1.0) |
| 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 EX12040 EURUSD_1_4 — Adaptive AMA+RSI+ATR+BB+MACD+Heiken Ashi scalper, 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 (0.01,0.01,2.0)
input int MagicNumber = 22212040; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_12040"; // Trade comment
input int Slippage = 3; // Slippage in points (1,1,10)
input group "=== Risk Management ==="
input double MaxSpread = 5.0; // Maximum spread in points (1.0,0.5,10.0)
input double MaxDrawdownPercent = 10.0; // Maximum drawdown percentage (5.0,1.0,20.0)
input double MaxRiskPerTrade = 2.0; // Maximum risk per trade % (0.5,0.5,5.0)
input int MaxOpenTrades = 5; // Maximum open trades (1,1,10)
input double StopLossPoints = 50.0; // Stop loss in points (20.0,5.0,150.0)
input double TakeProfitPoints = 100.0; // Take profit in points (40.0,10.0,300.0)
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 (10.0,5.0,50.0)
input double LockMinusBuffer = 15.0; // Lock profit minus X point buffer (5.0,2.0,30.0)
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 (10.0,5.0,50.0)
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 bool EnableIndicatorDebug = false; // Enable debug logging for indicators
input bool UseAMAforEntrySignals = true; // Use AMA for entry signals
input bool UseAMAforConfirmation = true; // Use AMA for confirmation
input bool UseRSIforEntrySignals = true; // Use RSI for entry signals
input bool UseRSIforConfirmation = true; // Use RSI for confirmation
input int AdaptiveMA_Period = 14; // Adaptive MA base period (8,2,30)
input double AdaptiveMA_Sensitivity = 2.0; // Adaptive sensitivity multiplier (1.0,0.5,5.0)
input group "=== RSI Settings ==="
input int RSI_Period = 14; // RSI period (7,1,21)
input double RSI_Oversold = 30.0; // RSI oversold level (20.0,1.0,40.0)
input double RSI_Overbought = 70.0; // RSI overbought level (60.0,1.0,80.0)
input bool RSI_UseCrossoverSignals = true; // Use RSI crossover signals
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.