Pipsgrowth EX03009 Grid
MT5 Expert Advisor (Open Source) · XAUUSD · M15, M5, H1
Pipsgrowth.com EX03009 Gold_Pyramid_Stacker — multi-filter pyramid with ATR step and basket management, full 12-layer stack.
Overview
Pipsgrowth EX03009 Gold Pyramid Stacker is a XAUUSD-oriented trend-following pyramid engine that layers positions in the direction of strength, with an optional grid-recovery branch for ranging markets. The EA was built around a single observation — that on the M15 chart gold tends to trend in bursts of 1–3 ATR, then mean-reverts — so it offers a stacker that loads into confirmed moves and a separate averaging module that triggers only when the user enables it. The two modes are not chained: pyramid is the default behavior, grid is opt-in via InpUseGrid, and each side respects the same protective ceiling (basket target, equity stop, trailing, breakeven, partial close) so the worst-case exposure stays visible.
The signal stack on every new-bar decision is six indicators deep. The EA creates handles for fast EMA(20), slow EMA(50), long EMA(200), RSI(14), ATR(14) and MACD(12,26,9) in OnInit and copies two bars from each buffer on every tick. A long signal requires fast MA above slow MA, bid above the 200 EMA, and — when the filters are active — RSI(1) below 70 and MACD main(1) above signal(1). The shorts mirror this. Filters are individually togglable: setting InpUseRSI or InpUseMACD to false skips that gate without removing the others. Once the trend gate is satisfied, the EA opens a single initial position with OpenBuy/OpenSell at InpInitialLot (0.01 default) or a risk-sized lot from CalculateLotSize if InpUseAutoLot is on.
Pyramiding kicks in after the first fill. Each subsequent long is added when bid clears the highest open buy by at least the dynamic step, where step defaults to ATR(14)×InpATRMultiplier (1.0 default) and falls back to InpPyramidStep (300 points) when InpUseATRStep is disabled. The added lot is last_buy_lot × InpLotMultiplier, normalized to the broker's lot step and capped at InpMaxLayers (10). The fast MA above slow MA check gates the new layer — the EA will not pyramid against the prevailing trend even if price has moved by step. This is the design point that separates a stacker from a martingale: the EA refuses to add to a position that the trend filter has flipped against, which means a single sharp reversal terminates the pyramid instead of loading it deeper.
The grid-recovery branch shares the same InpMaxLayers cap (so the EA can never accumulate more layers than the user authorized, regardless of which mode triggered the add) but uses its own step (InpGridStep, 300 points default), its own lot formula, and a separate counter InpMaxGridOrders (5). It runs only when InpUseGrid is true, and the lot escalates by InpGridMultiplier per add when the user picks GRID_STRATEGY_MARTINGALE — which is the default. The grid lot is hard-capped at InpMaxGridLot (5.0 lots), and the EA re-scans PositionsTotal to find the lot of the extremal position so that scaling compounds from the most-recent grid order rather than the oldest. With InpUseGrid false (the safer default), the EA never averages into a losing trade — it only pyramids into winners.
Risk management is layered in this order on every OnTick: RefreshRates → UpdateDailyCounters → IsSafeToTrade guard → Friday close → basket exit (target, trail, equity stop) → ManageOpenPositions (partial close, trailing, breakeven) → consec-loss pause → news filter → spread filter → signal/sizing → entry path. ManageOpenPositions is where most of the protective math happens: at +InpPCPips (400 points) the EA closes 50% of the position volume (rounded down to the lot step, gated at minLot); at +InpTrailStart (300 points) it ratchets the stop to bid/TrailStep behind price; at +InpBEActivation (200 points) it moves the stop to entry + InpBEOffset (10 points). All three SL moves go through TryModify_EX03009, which retries 3 times at 200ms on requote, timeout, price-off or price-changed responses and otherwise returns false silently.
The basket layer is the most distinctive exit. CheckBasketExit sums profit+swap+commission across every position with magic 22203009 on the symbol; when the sum hits InpBasketProfit (100 USD default) it closes the entire stack and emits a push/email alert. InpUseBasketTrail adds a meta-trailing stop: once basket profit clears InpBasketTrailStart (50 USD) the EA records the running maximum, and if the live total drops InpBasketTrailStep (20 USD) below that maximum it closes everything. The max resets to zero whenever the basket is empty. InpUseEquityStop ties a percentage drawdown on balance to a forced flatten — InpEquityStop = 20% means the EA will wipe all open positions if equity falls 20% below balance. The user can leave equity stop off and rely on the basket TP alone; the framework is decoupled on purpose.
Hardening is applied in IsSafeToTrade_EX03009 and the OnTradeTransaction hook. The session gate is London 7–16 GMT union New York 12–21 GMT with the weekend (Sat/Sun) blocked; the offset is auto-detected by DetectGMTOffset_EX03009 scanning -12..+12 and picking the offset that scores a weekday-and-business-hours best fit. Cooldown is enforced after the third consecutive losing deal: g_cooldownUntil is set to TimeCurrent() + InpCooldownMinutes × 60 (30 minutes default), and IsSafeToTrade returns false until the timer expires. InpDailyLossLimit and InpWeeklyLossLimit (both 0 disabled) further block new entries once the realized PnL hits the floor. The OnTradeTransaction handler distinguishes in/out deals by magic 22203009 and symbol, then updates g_realizedToday/g_realizedWeek and g_consecLossesHD. Daily counters rotate on day-of-month change; weekly counters on day-of-week change.
The OnTester fitness is (profit / maxDD) × PF, hard-gated at maxDD>0 and trades≥10. The dashboard OBJ_LABEL is rebuilt on every tick with balance, equity, drawdown percent, buy/sell position counts, current spread, and — when InpShowNewsPanel is on — the next high-impact USD event from CalendarValueHistory with minutes remaining. A red CLOSE ALL button and an orange PAUSE/RESUME button are wired through OnChartEvent; pressing PAUSE flips ea_paused and the dashboard status line shows STATUS: PAUSED (USER) until the user clicks again. Push notifications fire on every entry, partial close, basket TP, basket trail, and equity stop.
The combination of pyramid and grid on a single EA is the reason this script is on the very-high-risk list. Default settings open the door for up to 10 pyramid layers + 5 grid layers on the same direction, which on a single XAUUSD position can be substantial notional. The minimum deposit of 100 USD is the absolute floor at the smallest lot (0.01) on the smallest count of open positions — by the time ATR has tripled the dynamic step and partial closes have not yet triggered, real-world margin is far above the labelled minimum. Users who want a sane long-only default should set InpUseGrid=false, leave InpMaxLayers at 10 only on accounts that can sustain it, and tighten the basket target.
Strategy Deep Dive
On every tick the EA refreshes rates, copies two bars from each of the six indicator handles (fast EMA(20), slow EMA(50), trend EMA(200), RSI(14), ATR(14), MACD(12,26,9)), and runs the safety stack in fixed order: Friday flatten, basket exit (target/trail/equity stop), ManageOpenPositions (partial at +400pt, trailing from +300pt, breakeven from +200pt), consec-loss pause, news filter, spread filter, then the entry path. Initial entries fire when the closed-bar signal is satisfied; subsequent pyramid layers add when price advances at least one ATR-equivalent step (or 300 points fixed) above the highest open position, and the trend filter re-asserts each time — the EA refuses to pyramid against a flipped trend. The grid-recovery branch is gated behind InpUseGrid and uses a separate counter, lot formula and step, with martingale scaling and a 5.0-lot cap. Basket accounting is the real exit: the EA sums profit+swap+commission across all magic-22203009 tickets on the symbol and trips the close when the sum reaches the configured target or trails behind its own running maximum. The trade-transaction hook tracks daily/weekly realized PnL and enforces a 30-minute cooldown after three consecutive losses. OnTester fitness is (profit/maxDD)×PF, gated at maxDD>0 and trades≥10.
Initial entries open on a closed-bar signal that requires fast EMA(20) above slow EMA(50), bid above the 200 EMA trend filter, RSI(1) below 70 and MACD main(1) above signal(1) when those filters are enabled. Pyramiding adds to the highest open position when price advances by at least ATR(14)×InpATRMultiplier (or InpPyramidStep = 300 points when ATR is disabled), capped at InpMaxLayers with the new lot set to last_lot × InpLotMultiplier, and the trend filter re-asserts before each new layer. The grid-recovery branch (off by default) instead adds against price when it moves InpGridStep against the extremal position, with optional martingale scaling via InpGridMultiplier up to InpMaxGridOrders layers.
The EA closes on a basket target when the sum of profit+swap+commission across all magic-22203009 positions hits InpBasketProfit (100 USD default); a meta-trailing stop on the basket (InpUseBasketTrail) closes the stack when profit drops InpBasketTrailStep below its running maximum. An optional equity stop (InpEquityStop = 20%) wipes everything if equity falls that far below balance. Partial close fires at +InpPCPips (400 points) and trims 50% of position volume, and the trailing-stop module (InpTrailStart 300, InpTrailStep 50) ratchets the SL forward once price has moved by the start distance. The Friday close at 20:00 server time forcibly flattens all positions to prevent weekend gap exposure.
Per-trade stop is InpStopLoss (500 points default) — 5 USD per point on a 0.01-lot XAUUSD ticket — set as the initial SL on every new entry and modified by ManageOpenPositions. The breakeven module moves SL to entry + InpBEOffset (10 points) once profit exceeds InpBEActivation (200 points), and the trailing module pulls SL to InpTrailStep behind price once profit clears InpTrailStart (300 points). When the pyramid branches stack several tickets against the trend, the basket-level equity stop (InpEquityStop) and basket TP become the dominant capital guard rather than any single position SL.
Per-trade take-profit is disabled by default — InpTakeProfit=0 means the EA never sets a per-ticket TP and relies on the basket-level TP at InpBasketProfit (100 USD) to close the stack. The basket trailing-stop (InpUseBasketTrail) lets unrealized basket profit run once it clears InpBasketTrailStart (50 USD) and locks it in by closing the stack if it drops InpBasketTrailStep (20 USD) from the running maximum. Partial close at +InpPCPips (400 points) trims 50% of each position, leaving the remainder to run against the basket exit.
Suited to XAUUSD traders who run a small ECN account (the labelled minimum deposit is 100 USD) and want a pyramid-first design that adds to confirmed M15 trends rather than averaging into losers — keep InpUseGrid=false, leave InpMaxLayers at the default 10 only on accounts sized for it, and tighten the basket target from 100 USD down to a level that matches the account. The news filter and GMT-offset detection (London 7–16 ∪ NY 12–21) mean the EA is best run during the London and New York sessions on a broker that delivers the economic calendar to MQL5; the 30-minute cooldown after three losses and the daily/weekly loss limits make it usable on prop-firm accounts as long as the user calibrates those limits to the prop ruleset. ECN/Raw-spread brokers are required because the spread filter (InpMaxSpread = 500 points) is wide but not infinite, and slippage in ManageOpenPositions ratchets the SL only forward.
Strategy Logic
Pipsgrowth EX03009 Grid — Strategy Logic Analysis (from .mq5 source)
Family: Grid
Magic: 22203009
Version: 2.00
BRIEF:
Gold pyramid stacker EA using MA/RSI/MACD signal filters with ATR-based dynamic step. Pyramids into trends with trailing stops, breakeven, partial close, basket TP and equity protection. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
RefreshRates()OpenBuy()OpenSell()ManageOpenPositions()CheckBasketExit()CloseAllPositions()GetConsecutiveLosses()CalculateLotSize()GetNextHighImpactNews()IsHighImpactNews()CreateDashboard()UpdateDashboard()- ...and 13 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (61 total across 8 groups):
- [=== Signal Settings ===]
InpFastMA= 20 // Fast Moving Average Period - [=== Signal Settings ===]
InpSlowMA= 50 // Slow Moving Average Period - [=== Signal Settings ===]
InpTrendMA= 200 // Trend Moving Average Period - [=== Signal Settings ===]
InpUseRSI=true// UseRSIFilter - [=== Signal Settings ===]
InpRSIPeriod= 14 //RSIPeriod - [=== Signal Settings ===]
InpRSIUpper= 70 //RSIOverboughtLevel(Don't Buy Above) - [=== Signal Settings ===]
InpRSILower= 30 //RSIOversoldLevel(Don't Sell Below) - [=== Signal Settings ===]
InpUseMACD=true// UseMACDFilter(Main > Signal) - [=== Signal Settings ===]
InpMACDFast= 12 //MACDFastEMA - [=== Signal Settings ===]
InpMACDSlow= 26 //MACDSlowEMA - [=== Signal Settings ===]
InpMACDSignal= 9 //MACDSignalSMA - [=== Position Settings ===]
InpUseAutoLot=false// Use AutoLot(Risk %) - [=== Position Settings ===]
InpRiskPercent=1.0// Risk Percent per Trade - [=== Position Settings ===]
InpInitialLot=0.01// Initial LotSize(if Auto Lot isfalse) - [=== Position Settings ===]
InpLotMultiplier=1.0// Lot Multiplier for Stacked Positions - [=== Position Settings ===]
InpMaxLayers= 10 // Max Number of Stacked Positions - [=== Position Settings ===]
InpUseATRStep=true// UseATRfor Dynamic Step - [=== Position Settings ===]
InpATRPeriod= 14 //ATRPeriod - [=== Position Settings ===]
InpATRMultiplier=1.0//ATRMultiplier for Step - [=== Position Settings ===]
InpPyramidStep= 300 // FixedStep(points) ifATRdisabled - [=== Risk Management ===]
InpStopLoss= 500 // StopLoss(points) - [=== Risk Management ===]
InpTakeProfit= 0 // TakeProfit(points, 0 = No TP) - [=== Risk Management ===]
InpUseTrailing=true// Use Trailing Stop - [=== Risk Management ===]
InpTrailStart= 300 // TrailingStart(points profit) - [=== Risk Management ===]
InpTrailStep= 50 // TrailingStep(points) - [=== Risk Management ===]
InpUseBreakeven=true// Use Breakeven - [=== Risk Management ===]
InpBEActivation= 200 // BreakevenActivation(points) - [=== Risk Management ===]
InpBEOffset= 10 // BreakevenOffset(points) - [=== Risk Management ===]
InpUsePartialClose=true// Use Partial Close - [=== Risk Management ===]
InpPCPips= 400 // Partial CloseActivation(points) - [=== Risk Management ===]
InpPCLotPercent=50.0// Partial Close Lot % - [=== Risk Management ===]
InpUseBasketTP=true// Use Basket Take Profit - [=== Risk Management ===]
InpBasketProfit=100.0// Basket TargetProfit($) - [=== Risk Management ===]
InpUseBasketTrail=false// Use Basket Trailing Stop - [=== Risk Management ===]
InpBasketTrailStart=50.0// Basket TrailStart($) - [=== Risk Management ===]
InpBasketTrailStep=20.0// Basket Trail Step/Drop($) - [=== Risk Management ===]
InpUseEquityStop=false// Use EquityProtection(Stop Loss) - [=== Risk Management ===]
InpEquityStop=20.0// Max Drawdown % (Close All) - [=== Protection & Filters ===]
InpMaxSpread= 500 // Max SpreadAllowed(points) - [=== Protection & Filters ===]
InpUseTimeFilter=false// Use Time Filter - [=== Protection & Filters ===]
InpStartHour= 8 // Start TradingHour(Server Time) - [=== Protection & Filters ===]
InpEndHour= 20 // End TradingHour(Server Time) - [=== Protection & Filters ===]
InpUseFridayExit=true// Close All on Friday - [=== Protection & Filters ===]
InpFridayExitHour= 20 // Friday ExitHour(Server Time) - [=== Protection & Filters ===]
InpMaxConsecLoss= 3 // Max ConsecutiveLosses(0 = Disable) - [=== Protection & Filters ===]
InpUseNewsFilter=true// Use NewsFilter(High Impact) - [=== Protection & Filters ===]
InpNewsMinsBefore= 30 // Minutes Before News to Stop - [=== Protection & Filters ===]
InpNewsMinsAfter= 30 // Minutes After News to Wait - [=== Protection & Filters ===]
InpShowNewsPanel=true// Show Next News on Panel - [=== Notifications ===]
InpSendPush=true// Send Push Notifications - [=== Notifications ===]
InpSendEmail=false// Send Email Alerts - [=== Notifications ===]
InpAlertDrawdown=10.0//Alertif Drawdown > X % - [=== Grid/Recovery Settings ===]
InpUseGrid=false// Use GridRecovery(Averaging) - [=== Grid/Recovery Settings ===]
InpGridStrategy=GRID_STRATEGY_MARTINGALE// Grid Strategy - [=== Grid/Recovery Settings ===]
InpGridStep= 300 // GridStep(points) - [=== Grid/Recovery Settings ===]
InpGridMultiplier=1.0// Grid LotMultiplier(1.0= disabled) - [=== Grid/Recovery Settings ===]
InpMaxGridLot=5.0// Max Grid Lot Size - [=== Grid/Recovery Settings ===]
InpMaxGridOrders= 5 // Max Recovery Orders - [=== Trade Management ===]
InpMagicNumber=22203009// Magic Number - [=== Trade Management ===]
InpTradeComment= "Psgrowth.com Expert_03009" // TradeComment - [=== Hardening Trade Safety ===]
InpCooldownMinutes= 30 // --- Global variables
// Pipsgrowth EX03009 Grid — Execution Flow (from source analysis)
// Family: Grid
// Gold pyramid stacker EA using MA/RSI/MACD signal filters with ATR-based dynamic step. Pyramids into trends with trailing stops, breakeven, partial close, basket TP and equity protection. 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 — H1 or H4 is recommended for grid EAs
- 7Set grid step (pips), maximum orders, and lot size in the EA dialog
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InpFastMA | 20 | Fast Moving Average Period |
| InpSlowMA | 50 | Slow Moving Average Period |
| InpTrendMA | 200 | Trend Moving Average Period |
| InpUseRSI | true | Use RSI Filter |
| InpRSIPeriod | 14 | RSI Period |
| InpRSIUpper | 70 | RSI Overbought Level (Don't Buy Above) |
| InpRSILower | 30 | RSI Oversold Level (Don't Sell Below) |
| InpUseMACD | true | Use MACD Filter (Main > Signal) |
| InpMACDFast | 12 | MACD Fast EMA |
| InpMACDSlow | 26 | MACD Slow EMA |
| InpMACDSignal | 9 | MACD Signal SMA |
| InpUseAutoLot | false | Use Auto Lot (Risk %) |
| InpRiskPercent | 1.0 | Risk Percent per Trade |
| InpInitialLot | 0.01 | Initial Lot Size (if Auto Lot is false) |
| InpLotMultiplier | 1.0 | Lot Multiplier for Stacked Positions |
| InpMaxLayers | 10 | Max Number of Stacked Positions |
| InpUseATRStep | true | Use ATR for Dynamic Step |
| InpATRPeriod | 14 | ATR Period |
| InpATRMultiplier | 1.0 | ATR Multiplier for Step |
| InpPyramidStep | 300 | Fixed Step (points) if ATR disabled |
| InpStopLoss | 500 | Stop Loss (points) |
| InpTakeProfit | 0 | Take Profit (points, 0 = No TP) |
| InpUseTrailing | true | Use Trailing Stop |
| InpTrailStart | 300 | Trailing Start (points profit) |
| InpTrailStep | 50 | Trailing Step (points) |
| InpUseBreakeven | true | Use Breakeven |
| InpBEActivation | 200 | Breakeven Activation (points) |
| InpBEOffset | 10 | Breakeven Offset (points) |
| InpUsePartialClose | true | Use Partial Close |
| InpPCPips | 400 | Partial Close Activation (points) |
| InpPCLotPercent | 50.0 | Partial Close Lot % |
| InpUseBasketTP | true | Use Basket Take Profit |
| InpBasketProfit | 100.0 | Basket Target Profit ($) |
| InpUseBasketTrail | false | Use Basket Trailing Stop |
| InpBasketTrailStart | 50.0 | Basket Trail Start ($) |
| InpBasketTrailStep | 20.0 | Basket Trail Step/Drop ($) |
| InpUseEquityStop | false | Use Equity Protection (Stop Loss) |
| InpEquityStop | 20.0 | Max Drawdown % (Close All) |
| InpMaxSpread | 500 | Max Spread Allowed (points) |
| InpUseTimeFilter | false | Use Time Filter |
| InpStartHour | 8 | Start Trading Hour (Server Time) |
| InpEndHour | 20 | End Trading Hour (Server Time) |
| InpUseFridayExit | true | Close All on Friday |
| InpFridayExitHour | 20 | Friday Exit Hour (Server Time) |
| InpMaxConsecLoss | 3 | Max Consecutive Losses (0 = Disable) |
| InpUseNewsFilter | true | Use News Filter (High Impact) |
| InpNewsMinsBefore | 30 | Minutes Before News to Stop |
| InpNewsMinsAfter | 30 | Minutes After News to Wait |
| InpShowNewsPanel | true | Show Next News on Panel |
| InpSendPush | true | Send Push Notifications |
| InpSendEmail | false | Send Email Alerts |
| InpAlertDrawdown | 10.0 | Alert if Drawdown > X % |
| InpUseGrid | false | Use Grid Recovery (Averaging) |
| InpGridStrategy | GRID_STRATEGY_MARTINGALE | Grid Strategy |
| InpGridStep | 300 | Grid Step (points) |
| InpGridMultiplier | 1.0 | Grid Lot Multiplier (1.0 = disabled) |
| InpMaxGridLot | 5.0 | Max Grid Lot Size |
| InpMaxGridOrders | 5 | Max Recovery Orders |
| InpMagicNumber | 22203009 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_03009" | Trade Comment |
| InpCooldownMinutes | 30 | --- Global variables |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX03009 Gold_Pyramid_Stacker — multi-filter pyramid with ATR step and basket management, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>
#include <Trade\DealInfo.mqh>
#include <Trade\HistoryOrderInfo.mqh>
enum ENUM_GRID_STRATEGY
{
GRID_STRATEGY_FIXED, // Fixed Lot (Same as Initial)
GRID_STRATEGY_MARTINGALE // Martingale (Multiply Lot)
};
//--- Input parameters
input group "=== Signal Settings ==="
input int InpFastMA = 20; // Fast Moving Average Period
input int InpSlowMA = 50; // Slow Moving Average Period
input int InpTrendMA = 200; // Trend Moving Average Period
input bool InpUseRSI = true; // Use RSI Filter
input int InpRSIPeriod = 14; // RSI Period
input int InpRSIUpper = 70; // RSI Overbought Level (Don't Buy Above)
input int InpRSILower = 30; // RSI Oversold Level (Don't Sell Below)
input bool InpUseMACD = true; // Use MACD Filter (Main > Signal)
input int InpMACDFast = 12; // MACD Fast EMA
input int InpMACDSlow = 26; // MACD Slow EMA
input int InpMACDSignal = 9; // MACD Signal SMA
input group "=== Position Settings ==="
input bool InpUseAutoLot = false; // Use Auto Lot (Risk %)
input double InpRiskPercent = 1.0; // Risk Percent per Trade
input double InpInitialLot = 0.01; // Initial Lot Size (if Auto Lot is false)
input double InpLotMultiplier = 1.0; // Lot Multiplier for Stacked Positions
input int InpMaxLayers = 10; // Max Number of Stacked Positions
input bool InpUseATRStep = true; // Use ATR for Dynamic Step
input int InpATRPeriod = 14; // ATR Period
input double InpATRMultiplier = 1.0; // ATR Multiplier for Step
input int InpPyramidStep = 300; // Fixed Step (points) if ATR disabled
input group "=== Risk Management ==="
input int InpStopLoss = 500; // Stop Loss (points)
input int InpTakeProfit = 0; // Take Profit (points, 0 = No TP)
input bool InpUseTrailing = true; // Use Trailing Stop
input int InpTrailStart = 300; // Trailing Start (points profit)
input int InpTrailStep = 50; // Trailing Step (points)
input bool InpUseBreakeven = true; // Use Breakeven
input int InpBEActivation = 200; // Breakeven Activation (points)
input int InpBEOffset = 10; // Breakeven Offset (points)
input bool InpUsePartialClose= true; // Use Partial Close
input int InpPCPips = 400; // Partial Close Activation (points)
input double InpPCLotPercent = 50.0; // Partial Close Lot %
input bool InpUseBasketTP = true; // Use Basket Take Profit
input double InpBasketProfit = 100.0; // Basket Target Profit ($)
input bool InpUseBasketTrail = false; // Use Basket Trailing Stop
input double InpBasketTrailStart= 50.0; // Basket Trail Start ($)
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 Grid strategy EAs from our library
Pipsgrowth EX03026 Grid
Pipsgrowth.com EX03026 USDJPY_Aggressive_Pyramid — MTF Hull MA pyramid with regime detection, full 12-layer stack.
Pipsgrowth EX03001 Grid
Pipsgrowth.com EX03001 Thanos Grid Adaptive — bidirectional ATR-spaced stop-order grid, full 12-layer stack.
Pipsgrowth EX03020 Grid
Pipsgrowth.com EX03020 GridScalperMA — dynamic grid with MA trend filter, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.