Pipsgrowth EX14014 Scalper
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX14014 newScalper — Adaptive Gold scalper with Heiken Ashi, RSI, volatility filter and dynamic profit locking, full 12-layer stack.
Overview
Pipsgrowth EX14014 is a scalping expert for XAUUSD that runs entirely on in-code indicator calculations — no native iMA, iRSI, or iATR handles are created at all, which is unusual for an MT5 expert and means the EA carries no extra terminal indicator load. Its signal stack is built around a volatility-adaptive moving average, a 7-period RSI confirmation, an optional Heiken Ashi filter, and a volatility gate that requires the latest bar range to clear 0.5 points. The EA evaluates entries on each new M5 candle, decides direction from price action against the adaptive MA, and confirms with an RSI band that is tuned to gold rather than to the standard 30/70.
The adaptive period is the structural innovation. CalculateAdaptiveVolatility averages the high-low range over the larger of AdaptiveMA_Period and 10 bars, then divides the current bar's range by that 10-to-20-bar mean to compute a volatility ratio. That ratio, multiplied by AdaptiveMA_Sensitivity=3.0, feeds CalculateAdaptiveMA which then takes a simple mean of closes over a period that scales from 5 to 50 bars. The practical effect is that during quiet, low-range markets the MA stretches to 40-50 bars and filters out noise; during volatile sessions it compresses to 5-15 bars and tracks price much more tightly. The header advertises an Adaptive MA precisely because the period floats with market conditions rather than being a fixed window.
Entries are gated by a four-step funnel. First, IsMarketConditionsOK checks that the spread is below 5 points (and below 10 points — the EA explicitly rejects entries on 2× spike spreads because gold can move from 25 to 70 points in seconds during news), that account drawdown is below MaxDrawdownPercent=10%, and that total open positions on this magic are below MaxOpenTrades=5. Second, IsPositionManagementOK returns true for the first position in either direction, but for additional positions requires all existing same-direction positions to be at least MinProfitInPointsPerTradeToAdd=20 points in profit. This means you can have an open buy that is at -8 points, but you cannot stack another buy on top of it until it reaches +20. Third, IsOptimalTradingSession is bypassed by default because UseSessionFilter=false, but if flipped to true, restricts entries to London (8-16 GMT), New York (13-21 GMT), and the overlap window (14-16 GMT). Fourth, GetBuySignal/GetSellSignal returns the price-vs-MA condition plus a crossover or strong momentum condition plus the volatility gate, and GetConfirmationSignal verifies that the in-code RSI(7) sits between RSI_Oversold=40 and RSI_Overbought=60.
The 40-60 RSI band is worth pausing on. Standard RSI 30/70 zones flag oversold and overbought extremes; the gold-tuned 40-60 range instead excludes both extremes, meaning the EA is looking for RSI in the middle band where momentum is still active. This is closer to a no-extreme filter than a reversal filter — the EA will not fire on gold that has just printed a 25 RSI capitulation bar, but it will fire on a 45 RSI bar that crossed above an adaptive MA at 30-period dynamic length. The Heiken Ashi toggle, when UseHeikenAshi=true, replaces the regular price/MA logic with HA-close/MA logic, smoothing the signal in exchange for one extra bar of lag.
Position management splits into two layers. The first is the broker-side bracket: a 50-point stop loss and a 100-point take profit set at order placement, giving a 2:1 reward-to-risk profile that the static 2.0% MaxRiskPerTrade input is designed to size against (though in the live entry path the EA uses the fixed LotSize=1.0 rather than calling CalculateLotSize, so the risk-per-trade input is effectively a labeling input on the live path). The second layer is the dynamic profit lock. ManageDynamicStopLoss runs on every tick, tracks the highest profit achieved for each open position, and every time peak profit reaches a new 30-point threshold (LockProfitEvery_X_Points=30), it ratchets the stop loss to entry + (steps * 30 - 15) points. So at 30 points of peak profit, the stop is at entry+15; at 60, the stop is at entry+45; at 90, the stop is at entry+75. The 15-point buffer (LockMinusBuffer) keeps the stop from getting tagged on intra-bar wicks just above the lock line. The original 100-point TP is never modified by this function, so the position either hits TP cleanly or exits via the ratcheted stop on the way up.
The lot sizing is structurally unusual. CalculateLotSize implements a textbook risk-based formula — account balance times MaxRiskPerTrade/100 divided by stop-loss points times tick value / tick size, normalized to the broker's volume step and clamped to lot min/max — but CheckForEntry's live path uses the simpler double lotSizeToUse = LotSize without ever calling CalculateLotSize. That means the published input MaxRiskPerTrade=2.0 is descriptive only; live position size is whatever you set LotSize to. The default 1.0 lot is a heavy size for XAUUSD on a $100 account, and is more appropriate for $10,000+ accounts.
Retry logic and risk guards complete the picture. The EA defines three retry helpers — TryClose_EX14014, TryClosePartial_EX14014, TryModify_EX14014 — each looping up to 3 times on REQUOTE/TIMEOUT/PRICE_OFF/PRICE_CHANGED with a 200ms close-sleep or 100ms modify-sleep. Only TryModify_EX14014 is wired in (called from ManageDynamicStopLoss when ratcheting the stop). The other two are defined but never called from live code; their presence suggests they were intended for partial-close or emergency-close paths that the current version does not exercise. Slippage is set globally to 3 points via trade.SetDeviationInPoints(Slippage), and the trade comment is hardcoded to Psgrowth.com Expert_14014 for identification.
What to expect in practice. The strategy's edge is the combination of the gold-tuned 40-60 RSI confirmation, the volatility-adaptive MA, and the additional-position profit gate. By refusing to scale into a losing direction, the EA avoids the classic averaging-into-a-stop-run failure mode that many gold scalpers fall into. The cost is that the EA can sit on a single open position for long stretches while waiting for it to reach the +20 profit threshold before allowing a stack. Backtest quality is sensitive to spread assumptions — the 5-point filter plus the 2x spike gate will reject a meaningful fraction of marginal entries on a wide-spread broker, so realistic live results will be lower than backtest numbers unless the broker matches the assumed conditions. The 100-point TP at 2:1 RR means the EA needs a 38% win rate to break even on the bracket before commissions, but the ratcheting stop converts many of the small losses that would have happened at the 50-point SL into break-even-or-better exits, so the realized win rate is generally higher than the bracket alone implies. The absence of a hard equity stop or daily loss limit means the user is the last line of defense on drawdown — a 5-position-per-direction cap at 1.0 lot per position can produce a 10-lot open exposure during a fast XAUUSD session.
Strategy Deep Dive
All four indicators — adaptive MA, RSI, Heiken Ashi, and volatility — are calculated inside the EA with zero native iMA/iRSI/iATR handles, which is unusual for an MT5 expert. CalculateAdaptiveVolatility() derives a vol ratio from the high-low range and feeds it to CalculateAdaptiveMA(), which then takes a simple mean of closes over a dynamic period that floats between 5 and 50 bars. CalculateRSI() is a textbook in-code 7-period RSI, and CalculateHeikenAshi() builds HA open/close/high/low in arrays up to 20 bars deep. On every new M5 bar, CheckForEntry() chains IsMarketConditionsOK() to IsPositionManagementOK() to IsOptimalTradingSession() to GetBuy/SellSignal() (price vs adaptive MA plus crossover/momentum plus volatility gate) to GetConfirmationSignal() (RSI between 40 and 60, gold-tuned) to trade.Buy/Sell with broker-side 50/100 stops and a fixed 1.0 lot. Every tick, ManageDynamicStopLoss() ratchets the stop in 30-point steps with a 15-point buffer once peak profit clears each threshold; of three retry helpers, only TryModify_EX14014 is wired into the live modify call, while TryClose_EX14014 and TryClosePartial_EX14014 are defined but never called.
The EA waits for a new M5 candle, then looks for a buy when price is above the volatility-adaptive moving average and either the previous close crossed above the average or the latest candle has strong bullish momentum (body > 50% of range). The same pattern inverts for sells. A separate confirmation step requires the in-code RSI(7) to sit between 40 and 60 (gold-tuned zone, not the standard 30/70), and a volatility gate demands the recent bar's range exceed 0.5 points. The first position per direction ignores the additional-position rules; subsequent entries require all existing same-direction positions to be at least 20 points in profit, capped at 5 buys and 5 sells.
There is no explicit reverse-signal close — positions exit only via the broker-side stop loss at 50 points or take profit at 100 points. The EA's ManagePositions() and ManageDynamicStopLoss() functions run every tick, ratcheting the stop loss upward in 30-point steps (with a 15-point buffer) every time the position's highest profit reaches a new 30-point threshold. This creates a stepped trailing stop that locks incremental profit while leaving the original TP untouched. With a 100-point TP, the 30-point locking cadence produces up to three meaningful ratchet zones before target.
The initial stop is a broker-side 50-point stop loss set at order placement; the EA's ManageDynamicStopLoss() then upgrades this dynamically — once the position's peak profit reaches 30 points, the stop is ratcheted to entry+15, then to entry+45 at 60 points of peak, entry+75 at 90, and so on in 30-point steps with a 15-point buffer. A separate MaxDrawdownPercent=10% filter halts new entries (not a hard equity stop on existing positions) when account drawdown exceeds the threshold.
The take profit is a fixed 100-point broker-side TP set at order placement, giving a 2:1 reward-to-risk ratio against the 50-point initial stop. The dynamic stop loss ratchets up to lock incremental profit, but the original TP is never moved by ManageDynamicStopLoss() — the position either hits TP or exits via the stepped trailing stop. With a default 30-point ratchet cadence and 15-point buffer, the stop will be at entry+45 by the time price is 60 points in profit, well before the 100-point TP zone.
Run this on XAUUSD M5 with a minimum balance of $100, although the fixed 1.0-lot default plus gold's tick value will demand a much larger account in practice (1.0 lot of XAUUSD is roughly $100 per point). Use a low-spread ECN or RAW account — the spread filter rejects entries above 5 points and triggers a hard block on 2x spikes, so a broker that regularly runs 30+ point spreads on XAUUSD will starve the EA of trades. By default UseSessionFilter=false so it trades 24/7; flip the toggle to true to confine entries to London 8-16 GMT and New York 13-21 GMT (overlap 14-16 GMT is the highest-quality window). Risk level is HIGH because of the 5-positions-per-direction cap, the absence of equity protection, and the 100-point TP / 50-point SL asymmetric profile.
Strategy Logic
Pipsgrowth EX14014 Scalper — Strategy Logic Analysis (from .mq5 source)
Family: Scalper
Magic: 22214014
Version: 2.00
BRIEF:
Adaptive scalping EA for XAUUSD using Adaptive MA, RSI, Heiken Ashi, and volatility filter. Features dynamic profit locking, additional position management, and session filter. 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 10 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=22214014// Magic number - [===
BASICSETTINGS===]InpTradeComment= "Psgrowth.com Expert_14014" // 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= 8 // Adaptive MA base period (reduced for faster response) - [===
ADAPTIVEINDICATORS===]AdaptiveMA_Sensitivity=3.0// Adaptive sensitivity multiplier (increased) - [===
ADAPTIVEINDICATORS===]ConfirmationRSI_Period= 7 // ConfirmationRSIperiod (reduced for faster signals) - [===
ADAPTIVEINDICATORS===] RSI_Oversold =40.0//RSIoversoldlevel(adjusted for gold) - [===
ADAPTIVEINDICATORS===] RSI_Overbought =60.0//RSIoverboughtlevel(adjusted for gold) - [===
ADAPTIVEINDICATORS===]EnableIndicatorDebug=false// Enable indicator debug logging - [===
ADAPTIVEINDICATORS===]UseHeikenAshi=true// Use Heiken Ashi for smoother signals - [===
ADAPTIVEINDICATORS===]UseVolatilityFilter=true// Use volatility filter for entries - [===
ADAPTIVEINDICATORS===]VolatilityThreshold=0.5// Minimum volatility threshold in points (forXAUUSD) - [===
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 (14-16GMT)
// Pipsgrowth EX14014 Scalper — Execution Flow (from source analysis)
// Family: Scalper
// Adaptive scalping EA for XAUUSD using Adaptive MA, RSI, Heiken Ashi, and volatility filter. Features dynamic profit locking, additional position management, and session filter. 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 from the Navigator onto any chart (M1 or M5 recommended)
- 7In the EA dialog, enable Allow Algo Trading and set your lot size
- 8Click OK — the EA will begin trading automatically
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 | 22214014 | Magic number |
| InpTradeComment | "Psgrowth.com Expert_14014" | 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 | 8 | Adaptive MA base period (reduced for faster response) |
| AdaptiveMA_Sensitivity | 3.0 | Adaptive sensitivity multiplier (increased) |
| ConfirmationRSI_Period | 7 | Confirmation RSI period (reduced for faster signals) |
| RSI_Oversold | 40.0 | RSI oversold level (adjusted for gold) |
| RSI_Overbought | 60.0 | RSI overbought level (adjusted for gold) |
| EnableIndicatorDebug | false | Enable indicator debug logging |
| UseHeikenAshi | true | Use Heiken Ashi for smoother signals |
| UseVolatilityFilter | true | Use volatility filter for entries |
| VolatilityThreshold | 0.5 | Minimum volatility threshold in points (for XAUUSD) |
| 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 (14-16 GMT) |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX14014 newScalper — Adaptive Gold scalper with Heiken Ashi, RSI, volatility filter and dynamic profit locking, 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 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 = 22214014; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_14014"; // 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 = 8; // Adaptive MA base period (reduced for faster response)
input double AdaptiveMA_Sensitivity = 3.0; // Adaptive sensitivity multiplier (increased)
input int ConfirmationRSI_Period = 7; // Confirmation RSI period (reduced for faster signals)
input double RSI_Oversold = 40.0; // RSI oversold level (adjusted for gold)
input double RSI_Overbought = 60.0; // RSI overbought level (adjusted for gold)
input bool EnableIndicatorDebug = false; // Enable indicator debug logging
input bool UseHeikenAshi = true; // Use Heiken Ashi for smoother signals
input bool UseVolatilityFilter = true; // Use volatility filter for entries
input double VolatilityThreshold = 0.5; // Minimum volatility threshold in points (for XAUUSD)
input group "=== SESSION FILTER ==="
input bool UseSessionFilter = false; // Use trading session filter
input bool TradeLondonSession = true; // Trade during London session (8-16 GMT)
input bool TradeNewYorkSession = true; // Trade during New York session (13-21 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 Scalping strategy EAs from our library
Pipsgrowth EX14020 Scalper
Pipsgrowth.com EX14020 AIXAUUSDScalper — AI-assisted XAUUSD scalper, full 12-layer stack.
Pipsgrowth EX10006 Momentum-Scalper
Pipsgrowth.com EX10006 USDJPY Scalper — USDJPY pullback momentum scalper, full 12-layer stack.
Pipsgrowth EX14021 Scalper
Pipsgrowth.com EX14021 EURUSDScalper — BB + MACD divergence scalper, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.