Pipsgrowth EX01004 Adaptive
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX01004 AdaptiveForexMaster Fixed — multi-adaptive confirmation EA, full 12-layer stack, configurable timeframe, trailing/BE/profit-lock toggles, pyramid gate, spread filter, new-bar gate, filling mode detection.
Overview
Pipsgrowth EX01004 Adaptive sits in the middle of PipsGrowth's lineup as a deliberately conservative multi-confirmation EA — its design priority is trading fewer, higher-quality setups rather than chasing frequency. The strategy fuses five independent technical inputs into a single weighted score, then gates that score behind nine separate safety checks before any order reaches the broker. On a 14-period AMA, a 14-period RSI, a 12/26/9 MACD, a 14/3/3 Stochastic and a 14-period ATR, EX01004 builds a directional bias on closed bars, then asks IsSafeToTrade() whether the rest of the account is in a fit state to act on it.
The core of the engine is GetMarketSignal(). It pulls closed-bar values (shift 1, to avoid repaint) from the AMA, RSI, MACD, Stochastic, and ATR handles, then computes a five-part score. The AMA (Adaptive Moving Average, with a fast EMA of 2 and a slow EMA of 30) crossover contributes the heaviest weight at 0.4 — long when the previous bar closed below the AMA and the current closed bar is above it, short for the inverse. RSI(14) cross of a volatility-adjusted threshold contributes 0.2: the standard 30/70 oversold and overbought levels are pulled inward or outward by the ratio of the current ATR to the 3-bar ATR average, scaled by the adaptive sensitivity. MACD(12,26,9) line-vs-signal crossover contributes 0.2. Stochastic(14,3,3) zones contribute 0.1 when the main line is below 20 (long bias) or above 80 (short bias). Finally, a 5-bar vs 20-bar SMA trend filter contributes 0.1 as a directional bias. A composite score above 0.5 × adaptiveSensitivity returns long; below -0.5 × adaptiveSensitivity returns short; anything in between is silence.
The "adaptive" in the name comes from UpdateAdaptiveSensitivity(), which adjusts the threshold each tick based on equity movement. Three consecutive rises in account balance push the sensitivity up by 0.1, capping at 1.0; two consecutive drops pull it down by 0.1, with a 0.3 floor. In a quiet, trendless market, the score has a hard time crossing the threshold — so the EA simply does not trade. In a strong-trending market where the user is already winning, the threshold widens, and the EA starts to take more setups. The net effect is a feedback loop: winning streaks allow more trades, losing streaks force selectivity.
Before any order is sent, the EA runs through IsSafeToTrade(). This function layers nine independent gates: a capital cap (stop trading above InpCapAmount), a capital floor (force-close and stop trading below InpCapFloor, default $100), an equity floor (80% of the initial balance by default — breach triggers CloseAllPositions()), a daily loss limit (3% of initial balance via g_realizedToday updated through the OnTradeTransaction hook), a weekly loss limit (8%), a cooldown timer (30 minutes after three consecutive losses, governed by InpMaxConsecLosses and InpCooldownMin), a daily trade count cap (5 by default), a market-open check that uses the GMT-detected weekend gap to refuse Saturday and early-Sunday trading, and an active-session check (London 07-16 GMT or New York 12-21 GMT, with InpAvoidAsia defaulting to true). A AvoidNews input also blocks the 30-minute windows around the London and NY opens. The InpMaxDDPct kill switch at 20% total drawdown halts the EA permanently for the session.
The entry path also enforces a pyramid gate via PyramidGateAllows(). By default the gate is set to PyramidGate_ProfitOnly, meaning any existing position on the symbol must show at least 5 points of profit (InpProfitGatePoints) before a new same-direction entry is permitted. The alternative mode PyramidGate_ProfitAndSL further requires the existing position's stop to be in profit. InpMaxOpenPositions caps total open tickets at 5, so even a runaway market does not produce more exposure than that.
The order-execution routines OpenBuyOrder() and OpenSellOrder() size the position dynamically. The lot is computed in CalculateLotSize() as EffectiveCapital() × RiskPercent / (slPoints × tickValue), then normalized to the broker's volume step and capped at InpMaxLot (100.0). The stop loss is placed at currentPrice ± (ATR × SLMultiplier) (default 1.0), and the take profit at currentPrice ± (ATR × SLMultiplier × TPMultiplier) (default 2.0) — a 1:2 risk-reward ratio relative to the initial stop. The broker's SYMBOL_TRADE_STOPS_LEVEL minimum is respected; if ATR-derived stops would violate it, they are pushed out to the minimum distance. OrderCalcMargin() is consulted first to ensure the calculated lot can be funded by free margin, and the order is sent with the auto-detected supportedFillingMode (FOK, IOC, or RETURN, depending on what the broker advertises via SYMBOL_FILLING_MODE). DetectFillingMode() runs at OnInit() and persists for the lifetime of the EA.
Position management is the most actively written code path. Each tick, UpdatePositionManagement() runs a mark-and-sweep over the local currentPositions[] array, then for each surviving position checks four things: an opposite-signal exit (which calls TryClosePosition() with a 3-attempt retry on requotes and price changes), the break-even ratchet (in ApplyBreakEven()), the profit-lock ratchet (in ApplyProfitLock()), and the advanced ATR trailing stop (in UpdateAdvancedTrailing()). The break-even triggers at BreakEvenTrigger = 10 points of profit and moves the stop to entry exactly once. The profit lock fires every ProfitLockIncrement (10 points) of profit and ratchets the stop up by increment minus ProfitLockStep (3 points), so the stop is always 3 points behind the previous lock level. The advanced trailing stop uses TrailingATRMultiplier × ATR(14) as the trailing distance and only ever ratchets the stop in the favorable direction. All three modifications go through TryModify(), which has invalid-stops guard and a 3-attempt retry.
The EA is built primarily for XAUUSD on the M5 timeframe (the InpTimeframe input maps 3 to PERIOD_M5), though H1 and all the other standard periods are exposed via the same enum. The default magic number is 22201004, the trade comment is Psgrowth.com Expert_01004, and the GMT offset is auto-detected by scanning the H1 weekend gap in DetectGMTOffset() — the EA expects the server to honor the Friday 22:00 close and Sunday 22:00 open. If you use a non-standard server, you can override the offset with InpServerGMTOffset. The London/NY window filter assumes broker time minus the auto-detected offset maps cleanly to the GMT hour inputs.
For backtesting, the source defines no OnTester() pass/fail logic, so the EA's optimization fitness is the standard MT5 balance/max-DD ratio. Because the OnTradeTransaction hook updates g_realizedToday and g_realizedWeek for daily and weekly caps, the backtest will respect the 3% daily and 8% weekly drawdown limits just as it does live. The InpSignalOnBarClose default is true, which means signals are evaluated on bar close only — switching this to false lets signals re-evaluate on every tick and tends to produce materially different (and usually worse) results, because the closed-bar-shift-1 read in GetMarketSignal() is no longer guaranteed.
InpDryRun is one of the more useful inputs for live deployment: set it to true and the EA logs every signal it would have placed but does not send any orders, so you can verify the signal stream on a live broker feed without risking capital. The InpKillSwitch input is a hard stop — flipping it to true halts all trading immediately without removing the EA from the chart, useful as a panic button during a flash event or a broker-wide outage. The InpMaxLot cap is a structural ceiling: even if the risk calculation produces a larger size, the lot is clipped at 100.0 before OrderSend.
The codebase ships with no DLL imports, no web requests, and no encrypted strings. Everything the EA does is visible in Pipsgrowth_com_EX01004.mq5 and is open to modification, recompilation, and redistribution under the PipsGrowth terms. The three knobs that matter most for tuning are the composite-score weights inside GetMarketSignal() (currently 0.4/0.2/0.2/0.1/0.1), the volatility-scaling factor in the adaptive RSI thresholds, and the InpMaxDDPct kill switch value — everything else is convention. With RiskPercent at 1.0 and the 3% daily cap, the EA is sized for a $100 account that the developer explicitly calls out as the design minimum.
Strategy Deep Dive
At each new bar, EX01004 reads four standard indicator handles (AMA 14/2/30, RSI 14, MACD 12/26/9, Stochastic 14/3/3, ATR 14) on the closed bar at shift 1, then computes a single composite score: AMA crossover contributes 0.4, RSI oversold/overbought crossing 0.2, MACD line-vs-signal crossing 0.2, Stochastic 20/80 extremes 0.1, and a 5-vs-20 SMA trend 0.1. The RSI thresholds themselves are pulled wider or tighter by the current ATR vs the 3-bar ATR average, multiplied by the adaptive sensitivity — a self-tuning value that climbs by 0.1 after three consecutive winning balances and drops by 0.1 after two consecutive losing balances, clamped between 0.3 and 1.0. Before any order is sent, IsSafeToTrade() checks eight independent gates: capital cap/floor, equity-floor at 80%, daily-loss at 3%, weekly-loss at 8%, cooldown, max trades/day, market-open, active session (London 7-16 or NY 12-21 GMT by default with Asia avoided), and the 20% total-DD kill switch. The open-position path enforces the pyramid gate (PyramidGate_ProfitOnly by default — any existing position must show at least 5 points of profit before a new same-direction entry), and each managed position runs through ApplyBreakEven, ApplyProfitLock, and UpdateAdvancedTrailing on every tick so the stop is ratcheted by 1.5× ATR after a new high.
Long entries trigger when the AMA(14, 2, 30) is crossed upward by the close of the previous bar, with the weighted confirmation score (AMA 0.4 + RSI 0.2 + MACD 0.2 + Stoch 0.1 + SMA-trend 0.1) exceeding a self-tuning threshold derived from the adaptive sensitivity. The RSI oversold and overbought levels adjust dynamically based on the current ATR vs the 3-bar average ATR, so quiet markets require stronger signals than volatile ones. The bar-close gate (InpSignalOnBarClose) blocks signal evaluation except on a freshly opened bar, and the no-trade layer blocks orders when spread exceeds 50 points, the equity floor is breached, or the 30-minute cooldown is active after three consecutive losses.
Positions close on a confirmed opposite signal from the same composite stack, via the TryClosePosition() retry loop with a 10-point price deviation. If the signal does not flip, the position is still managed by three ratcheting mechanisms: the break-even trigger ratchets SL to entry at 10 points of profit, the profit-lock step ratchets SL in 10-point increments minus 3 points, and the ATR-based advanced trailing stop trails the bid/ask by 1.5× ATR. Position tickets are marked-and-swept each tick via UpdatePositionManagement() so closed tickets are pruned from the local tracking array.
The stop loss is computed at entry as ATR(14) × SLMultiplier (default 1.0), normalized to the symbol tick and bounded by the broker's minimum stop distance. Beyond per-trade SL, a hard drawdown kill switch at InpMaxDDPct = 20% halts all trading once the equity has dropped 20% from the initial balance, and an equity floor at 80% of the initial balance force-closes everything.
The take profit is computed at entry as ATR(14) × SLMultiplier × TPMultiplier (default 2.0), giving a fixed 1:2 risk-reward ratio relative to the initial stop. Once price advances, the fixed TP is preserved while the stop is ratcheted by the break-even, profit-lock, and advanced trailing mechanisms — so the TP acts as a cap while the trailing machinery keeps the downside on a ratchet.
Run on XAUUSD M5 (the default InpTimeframe=3 mapping) with the $100 minimum — the 1% RiskPercent and 3% daily loss cap are sized for a small-balance conservative deployment on a low-spread ECN. Recommended session is the London and New York overlap (12-16 GMT, when both InpLondonStartHour and InpNYStartHour windows are open and gold spreads are typically tightest), with the Asian session explicitly avoided per the default InpAvoidAsia=true. Avoid brokers with high XAUUSD spread spikes or weekend gold gaps larger than 2 hours, and use the InpDryRun input first to log signals without committing capital.
Strategy Logic
Pipsgrowth EX01004 Adaptive — Strategy Logic Analysis (from .mq5 source)
Family: Adaptive
Magic: 22201004
Version: 3.00
BRIEF:
Safe but profitable EA with multiple adaptive confirmations — AMA, RSI, MACD, Stochastic, ATR with self-tuning sensitivity and session filtering. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
DetectFillingMode()IsSafeToTrade()DetectGMTOffset()ServerToGMT()IsMarketOpen()InActiveSession()EffectiveCapital()IsNewsTime()GetMarketSignal()GetSMA()UpdateAdaptiveSensitivity()CalculateLotSize()- ...and 18 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (49 total across 8 groups):
- [=== Identity ===]
InpMagicNumber=22201004// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_01004" // TradeComment - [=== Identity ===]
InpTimeframe= 3 // Timeframe: 1=M1,2=M3,3=M5,4=M10,5=M15,6=M30,7=H1,8=H4,9=D1 - [=== Identity ===]
InpSignalOnBarClose=true// Evaluate signals only on new bar close - [=== Identity ===]
InpMaxSpread= 50 // Max spread in points (0=disabled) - [=== Risk Management ===]
RiskPercent=1.0// Risk percentage per trade (max 2% for $100 account) - [=== Risk Management ===]
MaxDailyLossPercent=3.0// Maximum daily loss percentage - [=== Risk Management ===]
MaxTradesPerDay= 5 // Maximum trades per day - [=== Risk Management ===]
MinEquityPercent=80.0// Stop trading if equity falls below this % of initial balance - [=== Risk Management ===]
InpMaxConsecLosses= 3 // Max consecutive losses before cooldown (0=disabled) - [=== Risk Management ===]
InpCooldownMin= 30 // Cooldown minutes after consec losses (0=disabled) - [=== Risk Management ===]
InpMaxWeeklyLossPct=8.0// Max weekly loss % (0=disabled) - [=== Capital Cap ===]
InpCapAmount=0.0// Capital cap amount (stop trading at this equity) - [=== Capital Cap ===]
InpCapFloor=100.0// Capital floor (stop trading below this equity) - [=== Sessions
Management(GMT) ===]InpServerGMTOffset= 0 // ServerGMToffset in hours (0=auto-detect via weekend gap) - [=== Sessions
Management(GMT) ===]InpLondonStartHour= 7 // London session start (GMT) - [=== Sessions
Management(GMT) ===]InpLondonEndHour= 16 // London session end (GMT) - [=== Sessions
Management(GMT) ===]InpNYStartHour= 12 // New York session start (GMT) - [=== Sessions
Management(GMT) ===]InpNYEndHour= 21 // New York session end (GMT) - [=== Sessions
Management(GMT) ===]InpAvoidAsia=true// Avoid Asian session - [=== Sessions
Management(GMT) ===]InpAsiaStartHour= 0 // Asian session start (GMT) - [=== Sessions
Management(GMT) ===]InpAsiaEndHour= 7 // Asian session end (GMT) - [=== Sessions
Management(GMT) ===]AvoidNews=true// Avoid trading during news - [=== Safety Caps ===]
InpMaxDDPct=20.0// Max total drawdown % (0=disabled, triggers kill switch) - [=== Safety Caps ===]
InpKillSwitch=false// Kill switch (stops all trading immediately) - [=== Safety Caps ===]
InpDryRun=false// Dry-run mode: log signals without trading - [=== Safety Caps ===]
InpMaxLot=100.0// Maximum lot size cap - [=== Adaptive Indicators ===] AMA_Period = 14 // Adaptive Moving Average period
- [=== Adaptive Indicators ===] AMA_FastEMA = 2 // Fast
EMAforAMA - [=== Adaptive Indicators ===] AMA_SlowEMA = 30 // Slow
EMAforAMA - [=== Adaptive Indicators ===] RSI_Period = 14 //
RSIperiod for adaptive calculation - [=== Adaptive Indicators ===] MACD_Fast = 12 //
MACDfast period - [=== Adaptive Indicators ===] MACD_Slow = 26 //
MACDslow period - [=== Adaptive Indicators ===] MACD_Signal = 9 //
MACDsignal period - [=== Adaptive Indicators ===] Stoch_K = 14 // Stochastic %K period
- [=== Adaptive Indicators ===] Stoch_D = 3 // Stochastic %D period
- [=== Adaptive Indicators ===] ATR_Period = 14 //
ATRperiod for volatility - [=== Trade Management ===] TPMultiplier =
2.0// Take Profit multiplier (conservative 1:2 RR) - [=== Trade Management ===] SLMultiplier =
1.0// Stop Loss multiplier - [=== Trade Management ===]
InpEnableBreakEven=true// Enable break-even move - [=== Trade Management ===]
BreakEvenTrigger=10.0// Break-even trigger in points - [=== Trade Management ===]
InpEnableProfitLock=true// Enable profit lock - [=== Trade Management ===]
ProfitLockIncrement=10.0// Profit lock increment in points - [=== Trade Management ===]
ProfitLockStep=3.0// Profit lock step (SL trails increment minus step) - [=== Trade Management ===]
InpPyramidGateMode=PyramidGate_ProfitOnly// Pyramid gate mode - [=== Trade Management ===]
InpProfitGatePoints=5.0// Minimum profit in points for pyramid gate - [=== Trade Management ===]
InpMaxOpenPositions= 5 // Max open positions (0=unlimited) - [=== Advanced Position Management ===]
UseAdvancedTrailing=true// Advanced trailing stop system - [=== Advanced Position Management ===]
TrailingATRMultiplier=1.5//ATRmultiplier for trailing distance
// Pipsgrowth EX01004 Adaptive — Execution Flow (from source analysis)
// Family: Adaptive
// Safe but profitable EA with multiple adaptive confirmations — AMA, RSI, MACD, Stochastic, ATR with self-tuning sensitivity and session filtering. 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 |
|---|---|---|
| InpMagicNumber | 22201004 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_01004" | Trade Comment |
| InpTimeframe | 3 | Timeframe: 1=M1,2=M3,3=M5,4=M10,5=M15,6=M30,7=H1,8=H4,9=D1 |
| InpSignalOnBarClose | true | Evaluate signals only on new bar close |
| InpMaxSpread | 50 | Max spread in points (0=disabled) |
| RiskPercent | 1.0 | Risk percentage per trade (max 2% for $100 account) |
| MaxDailyLossPercent | 3.0 | Maximum daily loss percentage |
| MaxTradesPerDay | 5 | Maximum trades per day |
| MinEquityPercent | 80.0 | Stop trading if equity falls below this % of initial balance |
| InpMaxConsecLosses | 3 | Max consecutive losses before cooldown (0=disabled) |
| InpCooldownMin | 30 | Cooldown minutes after consec losses (0=disabled) |
| InpMaxWeeklyLossPct | 8.0 | Max weekly loss % (0=disabled) |
| InpCapAmount | 0.0 | Capital cap amount (stop trading at this equity) |
| InpCapFloor | 100.0 | Capital floor (stop trading below this equity) |
| InpServerGMTOffset | 0 | Server GMT offset in hours (0=auto-detect via weekend gap) |
| InpLondonStartHour | 7 | London session start (GMT) |
| InpLondonEndHour | 16 | London session end (GMT) |
| InpNYStartHour | 12 | New York session start (GMT) |
| InpNYEndHour | 21 | New York session end (GMT) |
| InpAvoidAsia | true | Avoid Asian session |
| InpAsiaStartHour | 0 | Asian session start (GMT) |
| InpAsiaEndHour | 7 | Asian session end (GMT) |
| AvoidNews | true | Avoid trading during news |
| InpMaxDDPct | 20.0 | Max total drawdown % (0=disabled, triggers kill switch) |
| InpKillSwitch | false | Kill switch (stops all trading immediately) |
| InpDryRun | false | Dry-run mode: log signals without trading |
| InpMaxLot | 100.0 | Maximum lot size cap |
| AMA_Period | 14 | Adaptive Moving Average period |
| AMA_FastEMA | 2 | Fast EMA for AMA |
| AMA_SlowEMA | 30 | Slow EMA for AMA |
| RSI_Period | 14 | RSI period for adaptive calculation |
| MACD_Fast | 12 | MACD fast period |
| MACD_Slow | 26 | MACD slow period |
| MACD_Signal | 9 | MACD signal period |
| Stoch_K | 14 | Stochastic %K period |
| Stoch_D | 3 | Stochastic %D period |
| ATR_Period | 14 | ATR period for volatility |
| TPMultiplier | 2.0 | Take Profit multiplier (conservative 1:2 RR) |
| SLMultiplier | 1.0 | Stop Loss multiplier |
| InpEnableBreakEven | true | Enable break-even move |
| BreakEvenTrigger | 10.0 | Break-even trigger in points |
| InpEnableProfitLock | true | Enable profit lock |
| ProfitLockIncrement | 10.0 | Profit lock increment in points |
| ProfitLockStep | 3.0 | Profit lock step (SL trails increment minus step) |
| InpPyramidGateMode | PyramidGate_ProfitOnly | Pyramid gate mode |
| InpProfitGatePoints | 5.0 | Minimum profit in points for pyramid gate |
| InpMaxOpenPositions | 5 | Max open positions (0=unlimited) |
| UseAdvancedTrailing | true | Advanced trailing stop system |
| TrailingATRMultiplier | 1.5 | ATR multiplier for trailing distance |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "3.00"
#property strict
#property description "Pipsgrowth.com EX01004 AdaptiveForexMaster Fixed — multi-adaptive confirmation EA, full 12-layer stack, configurable timeframe, trailing/BE/profit-lock toggles, pyramid gate, spread filter, new-bar gate, filling mode detection."
//--- pyramid gate mode enum
enum PyramidGateMode
{
PyramidGate_Off=0, // No pyramid gate
PyramidGate_ProfitOnly, // Require existing trades be in profit
PyramidGate_ProfitAndSL // Require profit + SL secured in profit
};
//--- Timeframe mapping: 1=M1, 2=M3, 3=M5, 4=M10, 5=M15, 6=M30, 7=H1, 8=H4, 9=D1
ENUM_TIMEFRAMES MapTimeframe(int tf)
{
switch(tf)
{
case 1: return PERIOD_M1;
case 2: return PERIOD_M3;
case 3: return PERIOD_M5;
case 4: return PERIOD_M10;
case 5: return PERIOD_M15;
case 6: return PERIOD_M30;
case 7: return PERIOD_H1;
case 8: return PERIOD_H4;
case 9: return PERIOD_D1;
default: return PERIOD_M5;
}
}
// Input Parameters
input group "=== Identity ==="
input ulong InpMagicNumber = 22201004; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_01004"; // Trade Comment
input int InpTimeframe = 3; // Timeframe: 1=M1,2=M3,3=M5,4=M10,5=M15,6=M30,7=H1,8=H4,9=D1
input bool InpSignalOnBarClose = true; // Evaluate signals only on new bar close
input int InpMaxSpread = 50; // Max spread in points (0=disabled)
input group "=== Risk Management ==="
input double RiskPercent = 1.0; // Risk percentage per trade (max 2% for $100 account)
input double MaxDailyLossPercent = 3.0; // Maximum daily loss percentage
input int MaxTradesPerDay = 5; // Maximum trades per day
input double MinEquityPercent = 80.0; // Stop trading if equity falls below this % of initial balance
input int InpMaxConsecLosses = 3; // Max consecutive losses before cooldown (0=disabled)
input int InpCooldownMin = 30; // Cooldown minutes after consec losses (0=disabled)
input double InpMaxWeeklyLossPct = 8.0; // Max weekly loss % (0=disabled)
input group "=== Capital Cap ==="
// InpCapEnabled removed — use InpCapAmount=0 to disable // Enable capital cap (stop trading above cap)
input double InpCapAmount = 0.0; // Capital cap amount (stop trading at this equity)
input double InpCapFloor = 100.0; // Capital floor (stop trading below this equity)
input group "=== Sessions Management (GMT) ==="
input int InpServerGMTOffset = 0; // Server GMT offset in hours (0=auto-detect via weekend gap)
input int InpLondonStartHour = 7; // London session start (GMT)
input int InpLondonEndHour = 16; // London session end (GMT)
input int InpNYStartHour = 12; // New York session start (GMT)
input int InpNYEndHour = 21; // New York session end (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.