Pipsgrowth EX12039 MultiIndicatorConfluence
MT5 Expert Advisor (Open Source) · EURUSD · M5, H1
Pipsgrowth.com EX12039 EURUSD_1_3 — Adaptive AMA+RSI+ATR+BB+Heiken Ashi scalper, full 12-layer stack.
Overview
Pipsgrowth EX12039 is the EURUSD sibling of the MultiIndicatorConfluence family — an MT5 scalper that combines a volatility-adaptive simple moving average, an RSI(14) reversal gate, a Bollinger Bands(20, 2.0) breakout/mean-reversion mode toggle, an ATR(14) volatility filter, and a code-built Heiken Ashi confirmation into a single AND-combined decision stack. Magic number 22212039 means this instance is intentionally separated from EX12036/EX12037/EX12038, so you can stack several MultiIndicatorConfluence variants on the same account for portfolio-level diversification without order-tag collisions.
The signal pipeline starts in OnTick, but entry decisions only fire on a new bar. The UpdateAdaptiveIndicators() function runs every tick and refreshes four code-built arrays: adaptiveMA[], volatility[], rsiBuffer[], atrBuffer[], and the Heiken Ashi haOpen/haClose/haHigh/haLow quartet. The so-called "Adaptive MA" is not the standard iAMA — CalculateAdaptiveMA() averages close prices over an adaptivePeriod that CalculateAdaptiveVolatility() reshapes every bar. That function compares the current (high−low) range to a 20-bar average to compute a volatility ratio, then sets adaptivePeriod = AdaptiveMA_Period / (1 + (volRatio − 1) × AdaptiveMA_Sensitivity), clamped to the 5–50 bar range. In plain words: when ranges expand the period contracts (fast MA), when ranges contract the period expands (slow MA). The result is registered as a plain SMA over that period, not Kaufman's efficiency-ratio AMA. The header advertises an "AMA" but the runtime is a volatility-windowed simple moving average — closer to a Keltner-style slow-fast blend than a true adaptive MA.
The buy decision in GetBuySignal() chains five AND-conditions together. The price must close above the adaptive MA (trend), the current candle must be bullish, the ATR(14)-normalized volatility check must clear ATR_VolatilityMultiplier × VolatilityThreshold × pointValue (default 0.3 point threshold), the Bollinger Bands branch must agree, and the RSI(14) must have crossed up through the 30 oversold level if crossover mode is on. With BB_UseBreakoutStrategy=true (the default), the BB branch requires close > bbUpper[0]; flip the toggle to BB_UseMeanReversionStrategy=true and the BB branch instead requires close < bbLower[0] — the two modes are mutually exclusive, not blended. Heiken Ashi is the final AND-gate: when UseHeikenAshi=true, haClose[0] must be greater than haOpen[0] for a long. The sell path mirrors the buy exactly with inversed inequalities.
Confirmation runs through GetConfirmationSignal(), a 4-branch selector keyed on the RSI_UseCrossoverSignals and RSI_UseDivergenceSignals toggles. If both are true, confirmation fires when rsiCrossoverConfirm OR rsiDivergenceConfirm passes AND volumeConfirm (always true on retail FX) AND bbConfirm passes. Crossover confirmation = RSI crossed up through 30 OR down through 70. Divergence confirmation = a 5-bar swing comparison (price lower low with RSI higher low for bullish, price higher high with RSI lower high for bearish) requiring rsiBuffer size ≥ 10. The bbConfirm sub-routine computes priceToBBUpperRatio = (price − bbMiddle) / (bbUpper − bbMiddle) and priceToBBLowerRatio = (bbMiddle − price) / (bbMiddle − bbLower) — confirmation passes when either ratio exceeds 0.8 in breakout mode, or when the price sits in the inner half of the bands in mean-reversion mode. This 4-branch design is the EA's distinctive architecture — most EX12 siblings use a simpler 1-or-2-branch confirmation.
Management philosophy diverges from the trailing-stop patterns seen in the EA's volatility-filter-only siblings. Each new order ships with a static 50-point SL and 100-point TP (RR 1:2) on the order ticket itself — there is no separate initial-protection stage. After the position opens, ManageDynamicStopLoss() ratchets the stop in 30-point steps using a watermark pattern: it tracks the highest profit per position in lastHighestProfit[], computes lockSteps = floor(peakProfit / 30), and ratchets the stop to priceOpen + (lockSteps × 30 − 15) × pointValue. The 15-point LockMinusBuffer ensures the locked stop stays 15 points below the watermark — the SL never loosens, only tightens. If the position is closed and reopens at a similar level, the watermark resets naturally on the next tick.
The pyramid-into-winners policy is the second management pillar. AllowOnlyProfitableAdditions=true (default) means the EA will only stack a new ticket on top of existing buys if every existing buy is at least MinProfitInPointsPerTradeToAdd=20 points in the green. The check is per-direction: it walks PositionsTotal(), filters by magic 22212039, and computes per-position profit in points rather than account currency. MaxOpenTrades=5 applies per direction, so the absolute ceiling is 5 buys + 5 sells = 10 tickets in flight. RequireToCheckForConfirmationBeforeAdding=true forces every additional ticket to also pass GetConfirmationSignal() — a confirmation re-check, not a relaxation.
Pre-trade gates run in IsMarketConditionsOK() and IsOptimalTradingSession(). The market-conditions gate rejects entries when spread exceeds MaxSpread=5.0 points (and harder when it spikes above 5× that, an extreme-spread kill switch), when account drawdown breaches MaxDrawdownPercent=10.0%, or when ATR(14) drops below the volatility floor. The session gate is opt-in: UseSessionFilter=false by default, so live entries are unrestricted; if you flip it on, the EA allows entries only during London 08–16 GMT, New York 13–21 GMT, or the London/NY overlap 13–16 GMT. Critically, isTester = MQLInfoInteger(MQL_TESTER) makes the session gate short-circuit to true in the strategy tester, so backtests are not artificially clipped to specific hours. isTester is also why the same code path can produce different in-sample vs live behaviour — be careful when you compare backtest equity curves against forward runs.
Reliability is handled by three retry helpers — TryClose_EX12039(), TryClosePartial_EX12039(), and TryModify_EX12039() — each looping up to 3 attempts with 200ms sleep on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED for closes, and 100ms for modifies. Magic 22212039 is set on every trade.Buy() / trade.Sell() call via trade.SetExpertMagicNumber(MagicNumber) in OnInit, and the comment string Psgrowth.com Expert_12039 is stamped on every fill so the EAs segregate cleanly in journal reports.
Backtest expectations: with the default breakout-mode toggle on, this EA will trade less often than a typical multi-indicator confluence because every AND-condition must clear simultaneously. Trades cluster around Bollinger band punches that coincide with RSI reversals and Heiken Ashi confirmation, and most winning trades will exit either at the 100-point TP target or via the dynamic stop lock once the position moves 30+ points in the green. Drawdowns tend to come from sequences where the BB breakout is a false breakout that reverses into a mean-reversion regime — at which point the EA may stack additional tickets in the wrong direction (since the existing buys are still positive early in the reversal). Consider tightening MinProfitInPointsPerTradeToAdd from 20 to 30+ points or disabling AllowOnlyProfitableAdditions outright if you see martingale-like stacking during choppy regimes.
Deployment minimum is $100 on a low-spread ECN broker such as Exness, IC Markets, or Pepperstone — the ATR volatility gate expects a steady 1.2–2.0 point EURUSD spread, and the 3-retry close/modify helpers need round-trip latency under 50ms. The fixed LotSize=1.0 input assumes a 0.01-lot interpretation on a micro account (the comment constraint says 0.01–2.0 lots), so for a $100 micro account start with 0.01 lots and only scale up after 30+ validated backtest/trade days.
Strategy Deep Dive
On every tick, UpdateAdaptiveIndicators() recomputes the volatility-windowed SMA period from a (high−low) / 20-bar-average ratio, refills RSI(14), ATR(14), Bollinger Bands(20, 2.0), and code-built Heiken Ashi arrays. CheckForEntry() fires only on new bars, and only after IsMarketConditionsOK() clears the spread, drawdown, and ATR-volatility gates, IsPositionManagementOK() confirms existing tickets are profitable (or none exist), and IsOptimalTradingSession() permits the current hour — though isTester=true short-circuits the session gate inside the strategy tester. The buy/sell decision in GetBuySignal()/GetSellSignal() is a five-way AND between price-vs-adaptive-SMA direction, candle direction, ATR volatility, the chosen BB mode (breakout/mean-reversion), and Heiken Ashi candle direction. GetConfirmationSignal() adds a 4-branch selector on RSI crossover/divergence plus a BB-distance ratio test before the order fires via trade.Buy()/trade.Sell() with fixed 50pt SL and 100pt TP. After open, ManageDynamicStopLoss() ratchets the SL in 30-point steps with a 15-point buffer, and IsPositionDirectionProfitable() gates additional tickets at MinProfitInPointsPerTradeToAdd=20 points per direction. Three retry helpers (close / partial close / modify) handle REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED with 200ms/100ms back-off.
A buy fires when close is above the volatility-adaptive SMA, the current candle is bullish, ATR(14) clears the volatility floor, the Bollinger Bands branch agrees (close > bbUpper[0] in breakout mode, default), RSI(14) has crossed up through the 30 oversold level, and the Heiken Ashi candle is bullish — all five AND-combined. Sells mirror the buy with inverted inequalities and the opposite Heiken Ashi direction. Confirmation re-runs through GetConfirmationSignal(), which adds a 4-branch RSI crossover/divergence/BB-distance verification before any new order opens.
Positions exit in three ways: hit the 100-point take-profit target on the order ticket, hit the static 50-point stop-loss, or get stopped by the dynamic profit-lock system once the position moves 30+ points in the green. The dynamic lock ratchets in 30-point steps with a 15-point buffer below the watermark — so a 90-point peak locks 75 points in profit (3 steps × 30 − 15). There is no signal-based exit; positions stay open until the SL, TP, or the profit lock stops them out.
Every order opens with a static 50-point stop-loss hard-coded on the ticket via sl = ask - StopLossPoints * pointValue. After open, ManageDynamicStopLoss() tracks per-position peak profit in lastHighestProfit[] and ratchets the stop to priceOpen + (lockSteps × 30 − 15) × pointValue for buys, never loosening — only tightening. The 15-point LockMinusBuffer ensures the locked stop stays 15 points below the watermark, so the ratchet only fires after peak profit clears 30 points.
Every order opens with a static 100-point take-profit on the ticket via tp = ask + TakeProfitPoints * pointValue, giving a 1:2 risk-reward ratio against the 50-point SL. The TP never moves — it stays anchored at the entry price plus 100 points, and the dynamic stop-loss system handles trailing-style profit protection by ratcheting the SL rather than moving the TP.
Recommended minimum balance is $100 on a low-spread ECN broker such as Exness, IC Markets, or Pepperstone — the ATR(14) volatility gate expects a stable 1.2–2.0 point EURUSD spread, and the 3-retry close/modify helpers need round-trip latency under 50ms. Run on EURUSD M5 or H1 (the EA's default pair and the timeframes it was backtested on). Stack with other EX12-family EAs on the same account — magic 22212039 prevents order-tag collisions across EX12036/EX12037/EX12038. Start with 0.01 lots on a micro account and only scale up after 30+ validated backtest or live-trade days. Risk level: MEDIUM.
Strategy Logic
Pipsgrowth EX12039 MultiIndicatorConfluence — Strategy Logic Analysis (from .mq5 source)
Family: MultiIndicatorConfluence
Magic: 22212039
Version: 2.00
BRIEF:
Adaptive forex scalping EA combining AMA, RSI, ATR, Bollinger Bands and Heiken Ashi confluence. Supports BB breakout and mean-reversion modes, 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()CheckForEntry()GetBuySignal()GetSellSignal()GetConfirmationSignal()IsMarketConditionsOK()- ...and 11 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (53 total across 10 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=22212039// Magic number - [=== Basic Settings ===]
InpTradeComment= "Psgrowth.com Expert_12039" // 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 - [=== Additional Indicators ===]
UseHeikenAshi=true// Use Heiken Ashi for smoother signals - [=== 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 EX12039 MultiIndicatorConfluence — Execution Flow (from source analysis)
// Family: MultiIndicatorConfluence
// Adaptive forex scalping EA combining AMA, RSI, ATR, Bollinger Bands and Heiken Ashi confluence. Supports BB breakout and mean-reversion modes, 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 | 22212039 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_12039" | 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 |
| UseHeikenAshi | true | Use Heiken Ashi for smoother signals |
| 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 EX12039 EURUSD_1_3 — Adaptive AMA+RSI+ATR+BB+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 = 22212039; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_12039"; // 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.