P
PipsGrowth
Trend FollowingOpen Source – Free

Pipsgrowth EX16061 Trend

MT5 Expert Advisor (Open Source) · XAUUSD · M5

Pipsgrowth.com EX16061 OptimizedEA -- Optimized multi-indicator EA with RSI, MBS, Magic indicator and adaptive confirmation, full 12-layer stack.

Overview

Pipsgrowth EX16061 Trend is built around a single, almost stubborn idea: the only setups worth trading are the ones where structure, momentum, and volatility all line up at the same bar. Most indicator systems treat signals as independent votes. EX16061 treats them as a chain — one indicator proposes, the next filter checks whether the proposal is credible, the third filter verifies the market is actually moving, and only then does the EA risk a position. The proposal/filter/verify logic is what the source code calls a 12-layer architecture: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, and OnTester fitness.

Out of the box, only two of those indicator layers are actually switched on for entry. The Momentum Breakout Structure (MBS) layer has both MBS_EntrySignal_BUY and MBS_EntrySignal_SELL enabled. The Donchian Channel layer also has both DC_EntrySignal_BUY and DC_EntrySignal_SELL enabled. Every other entry layer — RSI, HMA (Hull Moving Average), and the proprietary Magic indicator — is shipped disabled. The 182 input parameters let the trader wake any of those layers up and decide whether each one votes as an entry signal, a confirmation, an exit trigger, or an exit confirmation. By default the EA therefore opens on a Donchian channel breakout that the MBS layer has signed off on, with no further confirmations required.

The MBS layer (MBS_Decision()) reads its own Higher Timeframe through g_MBS_Timeframe, looks back MBS_LookbackBars bars for structure, and only fires when a breakout is at least MBS_MinBreakoutSize points. It then checks momentum (MBS_MomentumThreshold, default 0.7) and trend strength (MBS_TrendStrengthMin, default 0.6) before the signal becomes a candidate. Volume has to spike by MBS_VolumeMultiplier (1.5x) and the breakout has to clear an ATR filter based on MBS_ATRPeriod (14) and MBS_ATRMultiplier (1.0). The Donchian layer (DonchianChannel_Decision()) reads DC_ChannelPeriod (20) bars of high/low and only accepts breakouts that exceed DC_MinBreakoutPoints (10) with DC_ConfirmationBars (2) bars of confirmation. A pullback filter (DC_MinPullbackPoints) and a minimum channel range (DC_MinRangePoints, 20 points) prevent the EA from trading in noise.

Every new bar the EA re-evaluates the whole chain. ProcessTradingLogic() first calls ClassifyRegime() to decide whether the chart is trending, ranging, or volatile. If the regime does not pass, the entry is rejected before any signal is generated. The No-Trade Gate then runs through IsMarketOpen(), IsSpreadAcceptable() (rejects if MaxSpread = 30.0 is breached), IsWithinSession() (London 8–17 and New York 13–22 by default, both UseSessionLondon and UseSessionNewYork true), the MaxOpenTrades cap (5), the MaxDrawdownPercent (10.0%) hard stop, and the MaxRiskPerTrade (2.0%) per-trade cap. A KillSwitch and consecutive-loss counter add an extra safety layer if a streak of losses occurs.

Position sizing uses a fixed LotSize of 0.01 — the EA does not derive lot from the risk percentage, the MaxRiskPerTrade input is a guardrail rather than a sizing formula. The ExecuteTrade() function hands the order to the standard CTrade instance with ORDER_FILLING_FOK, 3 points of slippage, and the magic number 22216061 hard-coded as the MagicNumber input and also burned into the g_MagicNumber constant. Each open gets the comment Psgrowth.com Expert_16061 so it is easy to filter in the terminal.

The 12-layer architecture is more than a marketing label. Look at the function list: the time subsystem is its own layer (10 functions: GetAdjustedTime(), IsWithinSession(), IsSessionActive(), IsSessionOverlap(), IsEndOfDayTime(), IsEndOfWeekTime(), IsTradingDay(), IsNewsTime(), IsTimeBasedEntryPaused(), IsTimeFilterValid(), plus ManageEODPositions() and ManageEOWPositions() for forced closes). The signal subsystem is another layer (RSI_Decision(), MBS_Decision(), DonchianChannel_Decision(), HMA_Decision(), plus a parallel Magic_Decision() plus CheckRSIConfirmation(), CheckMBSConfirmation(), CheckDCConfirmation(), CheckHMAConfirmation(), CheckMagicConfirmation()). The trade-management layer runs the profit lock — EnableDynamicLockProfit (true by default) means LockProfitEvery_X_Points (30.0) the EA ratchets the stop by LockMinusBuffer (15.0) points behind the current price, every 30 points of profit. A CanAddNewPosition() gate enforces the AllowOnlyProfitableAdditions rule: the EA will only pyramid onto an existing position if every other open position is already at least MinProfitInPointsPerTradeToAdd (20) points in profit.

The Magic indicator deserves a special note. It is the EA's own custom signal: GetMagicBandsBuffer() returns a volatility envelope, GetMagicATR() reads its ATR, GetMagicEMA_HTF() reads a higher-timeframe EMA, and MagicFilter() decides whether price action is inside the bands or breaking out. The UseAutoFilter switch (true by default) lets the bands adapt to the symbol's recent volatility instead of using fixed distances. Even with UseMagic_Decision enabled, the Magic indicator's individual buy/sell flags are off by default — turning them on lets Magic act as an entry signal of its own. The same is true for RSI (period 14, oversold 30, overbought 70) and the HMA (period 21, ATR noise filter at 1.5×). Each of these can vote as a signal, a confirmation, an exit trigger, or an exit confirmation — the trader chooses the role.

A real-world setup usually looks like this: leave MBS and Donchian as your entry triggers (the defaults), turn on RSI_Confirm_BUY so a long only fires when RSI(14) on the chosen higher timeframe is above 50, turn on HMA_Confirm_BUY so the HMA(21) slope is positive, leave the Magic indicator as a confirmation-only filter via UseMagic_Decision, and let the trailing profit lock manage the exit. The result is an EA that opens a handful of high-conviction positions per session instead of dozens of marginal ones. If you want more signals, enable RSI entries and disable the Donchian ones; if you want fewer but cleaner signals, add a 1-bar delay via EnableDelayFilter (off by default) and require pullback confirmation in the Donchian filter.

The OnTester() block is the last layer. It builds a custom fitness function that weights Recovery Factor, ROI, Profit Factor, trade count, Sharpe ratio, and inverse drawdown, so the MT5 Strategy Tester's optimization pass ranks parameter combinations by a composite score rather than raw profit. That is the practical reason there are 182 inputs — the file is built to be optimized, not to be hand-tuned on a live chart. For live use, the safer move is to lock the inputs the tester found and disable EnableTrading only when you are not actively monitoring the EA.

Because the EA has a 10% hard drawdown cap and a 2% per-trade risk ceiling, the recommended capital is at least 1,000 USD on a micro-lot account so the first losing streak does not threaten the 10% floor. The default LotSize = 0.01 keeps margin usage small on FX majors and moderate on XAUUSD. Slippage is set to 3 points and the magic number 22216061 is reserved, so the EA can run alongside other PipsGrowth EX-series EAs without position-accounting collisions. The comment string Psgrowth.com Expert_16061 makes it easy to filter the trade history by EA in the MT5 terminal.

Strategy Deep Dive

On every new bar the EA re-evaluates the full 12-layer chain. ProcessTradingLogic() calls ClassifyRegime() first — if the chart is not in a confirmed trend or high-volatility breakout state, the rest of the chain is skipped. The No-Trade Gate then checks IsMarketOpen(), IsSpreadAcceptable() against MaxSpread (30 points), IsWithinSession() (London 8–17 + New York 13–22 GMT by default), MaxOpenTrades (5), the 10% drawdown cap, and the 2% per-trade risk ceiling. The two active entry layers — MBS_Decision() and DonchianChannel_Decision() — then vote; both must agree on direction for a signal to become a candidate, and any optional confirmations (RSI, HMA, Magic — all default off) can be layered on top. Sizing uses a fixed LotSize (0.01) and orders are sent via ExecuteTrade() with ORDER_FILLING_FOK and 3 points of slippage. Open positions are managed tick-by-tick by ManageOpenPositions(): the dynamic profit-lock ratchets the stop every 30 points, and the time subsystem runs ManageEODPositions() / ManageEOWPositions() for forced closes if those filters are enabled. The OnTester() block builds a composite fitness score (weighted Recovery Factor, ROI, Profit Factor, trade count, Sharpe, inverse drawdown) so MT5's optimizer ranks parameter sets by a balanced score rather than raw profit.

Entry Signal

On every new bar the EA re-runs the 12-layer chain. The default-on entry layers are MBS (Momentum Breakout Structure) and Donchian Channel. A long entry requires the MBS layer to confirm a structure breakout of at least MBS_MinBreakoutSize (50) points with momentum above 0.7 and trend strength above 0.6, while the Donchian layer must validate a 20-bar channel breakout exceeding DC_MinBreakoutPoints (10) with 2 bars of confirmation. The No-Trade Gate must pass: market open, spread below MaxSpread (30 points), session active, fewer than MaxOpenTrades (5) positions, drawdown below MaxDrawdownPercent (10.0%), and per-trade risk below MaxRiskPerTrade (2.0%).

Exit Signal

Exit is governed by either a reverse-signal flip from the active entry layer (MBS or Donchian printing against the open position) or by the dynamic profit-lock ratchet in ManageOpenPositions(). The ratchet is on by default: every 30 points of unrealized profit (LockProfitEvery_X_Points) the stop is pulled to price minus LockMinusBuffer (15) points. Optional exit triggers from RSI, HMA, MBS, Donchian, and Magic layers (all default off) can be turned on to fire additional closes, and the time subsystem will force-close all positions via ManageEODPositions() or ManageEOWPositions() if the relevant end-of-day or end-of-week filter is enabled.

Stop Loss

Initial stop-loss is fixed at StopLossPoints (100 points, equivalent to $1.00 on a 0.01-lot XAUUSD position) and is attached at entry. A 10.0% hard drawdown cap (MaxDrawdownPercent) acts as the global account-level stop, and the 2.0% per-trade risk ceiling (MaxRiskPerTrade) prevents any single position from jeopardizing the equity curve. Once the trade is in profit, the dynamic lock ratchets the stop every 30 points to lock in gains without cutting the move short.

Take Profit

There is no fixed take-profit level — TakeProfitPoints (200 points) is declared in the input block but the EA's management philosophy is to let winners run. The dynamic profit-lock ratchet (LockProfitEvery_X_Points = 30, LockMinusBuffer = 15) is the primary exit mechanism, effectively behaving as a chandelier trailing stop. The pyramid guard AllowOnlyProfitableAdditions and the MinProfitInPointsPerTradeToAdd (20-point) gate let the EA add to a position only when the existing trade is already in profit, scaling into strength rather than into weakness.

Best For

Best deployed on XAUUSD M5 with the default 0.01-lot sizing. Minimum recommended balance is $1,000 to absorb a realistic losing streak before the 10% drawdown cap triggers; the platform's hard $100 minimum is too thin for the EA's 100-point initial stop and 2% per-trade risk. Use a low-spread ECN broker with sub-1-pip spreads on gold (or sub-0.5 pip on the major FX pairs the file is portable to) so the 30-point MaxSpread does not block the majority of breakouts. The default-active London 8–17 + New York 13–22 GMT session window is the right trading window for XAUUSD — outside those hours the structure-breakout rate drops and the Donchian filter starts producing false positives. The MEDIUM risk label is honest: with MaxRiskPerTrade = 2.0% and MaxDrawdownPercent = 10.0% the EA is not a low-risk grid, but the per-trade ceiling plus the profit-lock ratchet make it considerably calmer than a martingale or uncontrolled breakout EA.

Strategy Logic

Pipsgrowth EX16061 Trend — Strategy Logic Analysis (from .mq5 source)

Family: Trend Magic: 22216061 Version: 2.00

BRIEF: Optimized Expert Advisor addressing 100+ performance and structure issues, combining RSI entry signals, Momentum Breakout Structure (MBS), Magic indicator and adaptive confirmation for USDJPY with dynamic profit management. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • GetAdjustedTime()
  • ValidateTimeInputs()
  • IsWithinSession()
  • IsSessionActive()
  • IsSessionOverlap()
  • IsEndOfDayTime()
  • IsEndOfWeekTime()
  • IsTradingDay()
  • IsNewsTime()
  • IsTimeBasedEntryPaused()
  • IsTimeFilterValid()
  • ManageEODPositions()
  • ...and 51 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (182 total across 21 groups):

  • [=== BASIC SETTINGS ===] EnableTrading = true // Enable trading
  • [=== BASIC SETTINGS ===] EnableDebug = false // Enable debug logging
  • [=== BASIC SETTINGS ===] LotSize = 0.01 // Fixed lot size
  • [=== BASIC SETTINGS ===] MagicNumber = 22216061 // Magic number
  • [=== BASIC SETTINGS ===] InpTradeComment = "Psgrowth.com Expert_16061" // Trade comment
  • [=== BASIC SETTINGS ===] Slippage = 3 // Slippage in points
  • [=== RISK MANAGEMENT ===] MaxSpread = 30.0 // Maximum spread in points
  • [=== RISK MANAGEMENT ===] MaxDrawdownPercent = 10.0 // Maximum drawdown percentage
  • [=== RISK MANAGEMENT ===] MaxRiskPerTrade = 2.0 // Maximum risk per trade %
  • [=== RISK MANAGEMENT ===] MaxOpenTrades = 5 // Maximum open trades
  • [=== RISK MANAGEMENT ===] StopLossPoints = 100.0 // Stop loss in points
  • [=== RISK MANAGEMENT ===] TakeProfitPoints = 200.0 // Take profit in points
  • [=== DYNAMIC PROFIT MANAGEMENT ===] EnableDynamicLockProfit = true // Enable dynamic profit locking
  • [=== DYNAMIC PROFIT MANAGEMENT ===] LockProfitEvery_X_Points = 30.0 // Step: every X points profit
  • [=== DYNAMIC PROFIT MANAGEMENT ===] LockMinusBuffer = 15.0 // Lock profit minus X point buffer
  • [=== POSITION MANAGEMENT ===] AllowOnlyProfitableAdditions = true // Only allow adding positions if existing trades are profitable
  • [=== POSITION MANAGEMENT ===] MinProfitInPointsPerTradeToAdd = 20.0 // Minimum profit required per existing trade in points
  • [=== RSI SETTINGS ===] RSI_EntrySignal_BUY = false // Enable RSI BUY entry signal
  • [=== RSI SETTINGS ===] RSI_EntrySignal_SELL = false // Enable RSI SELL entry signal
  • [=== RSI SETTINGS ===] RSI_Confirm_BUY = false // Require RSI BUY confirmation
  • [=== RSI SETTINGS ===] RSI_Confirm_SELL = false // Require RSI SELL confirmation
  • [=== RSI SETTINGS ===] RSI_ExitTrigger_BUY = false // Enable RSI BUY exit trigger
  • [=== RSI SETTINGS ===] RSI_ExitTrigger_SELL = false // Enable RSI SELL exit trigger
  • [=== RSI SETTINGS ===] RSI_ExitConfirm_BUY = false // Require RSI BUY exit confirmation
  • [=== RSI SETTINGS ===] RSI_ExitConfirm_SELL = false // Require RSI SELL exit confirmation
  • [=== RSI SETTINGS ===] RSI_TF = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for RSI
  • [=== RSI SETTINGS ===] RSI_Period = 14 // RSI period
  • [=== RSI SETTINGS ===] RSI_Price = 1 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied price for RSI
  • [=== RSI SETTINGS ===] RSI_Overbought = 70.0 // RSI overbought level
  • [=== RSI SETTINGS ===] RSI_Oversold = 30.0 // RSI oversold level
  • [=== RSI SETTINGS ===] RSI_SignalShift = 0 // Shift for RSI signal line
  • [=== RSI SETTINGS ===] RSI_Midline = 50 // RSI midline level
  • [=== RSI SETTINGS ===] RSI_ExtremeBuffer = 5 // Buffer for extreme levels
  • [=== RSI SETTINGS ===] RSI_MinRange = 5.0 // Minimum RSI range for valid signal
  • [=== RSI SETTINGS ===] RSI_MinVolatility = 2.0 // Minimum volatility threshold
  • [=== RSI SETTINGS ===] RSI_MomentumBars = 3 // Bars for momentum confirmation
  • [=== RSI SETTINGS ===] RSI_DeadZoneSize = 5.0 // Dead zone around midline
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_EntrySignal_BUY = true // Enable MBS BUY entry signal
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_EntrySignal_SELL = true // Enable MBS SELL entry signal
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_Confirm_BUY = false // Require MBS BUY confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_Confirm_SELL = false // Require MBS SELL confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ExitTrigger_BUY = false // Enable MBS BUY exit trigger
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ExitTrigger_SELL = false // Enable MBS SELL exit trigger
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ExitConfirm_BUY = false // Require MBS BUY exit confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ExitConfirm_SELL = false // Require MBS SELL exit confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for analysis
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_LookbackBars = 20 // Lookback period for structure analysis
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_MinBreakoutSize = 50 // Minimum breakout size in points
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_MomentumThreshold = 0.7 // Momentum strength threshold (0-1)
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ConfirmationBars = 2 // Bars needed for confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_VolatilityFilter = 1.5 // Volatility filter multiplier
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_TrendStrengthMin = 0.6 // Minimum trend strength (0-1)
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_RequireVolumeSpike = true // Require volume confirmation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_VolumeMultiplier = 1.5 // Volume spike multiplier
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ATRPeriod = 14 // ATR period for volatility
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_ATRMultiplier = 1.0 // ATR multiplier for breakout validation
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_EMAPeriod = 21 // EMA period for trend direction
  • [=== MOMENTUM + STRUCTURE BREAKOUT SETTINGS ===] MBS_MinPriceMovement = 0.0001 // Minimum price movement for signal
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_EntrySignal_BUY = true // Enable Donchian Channel BUY entry signal
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_EntrySignal_SELL = true // Enable Donchian Channel SELL entry signal
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_Confirm_BUY = false // Require Donchian Channel BUY confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_Confirm_SELL = false // Require Donchian Channel SELL confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ExitTrigger_BUY = false // Enable Donchian Channel BUY exit trigger
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ExitTrigger_SELL = false // Enable Donchian Channel SELL exit trigger
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ExitConfirm_BUY = false // Require Donchian Channel BUY exit confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ExitConfirm_SELL = false // Require Donchian Channel SELL exit confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for Donchian Channel
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ChannelPeriod = 20 // Lookback period for channel
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ConfirmationBars = 2 // Bars needed for confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_MinBreakoutPoints = 10 // Minimum breakout size in points
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ATRMultiplier = 1.0 // ATR multiplier for volatility filter
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_ATRPeriod = 14 // ATR period for volatility
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_RequireVolumeSpike = false // Require volume spike confirmation
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_VolumeMultiplier = 1.5 // Volume spike multiplier
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_MinPullbackPoints = 5 // Minimum pullback before breakout
  • [=== DONCHIAN CHANNEL SETTINGS ===] DC_MinRangePoints = 20 // Minimum channel range to avoid chop
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_EntrySignal_BUY = false // Enable HMA BUY entry signal
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_EntrySignal_SELL = false // Enable HMA SELL entry signal
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_Confirm_BUY = false // Require HMA BUY confirmation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_Confirm_SELL = false // Require HMA SELL confirmation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_ExitTrigger_BUY = false // Enable HMA BUY exit trigger
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_ExitTrigger_SELL = false // Enable HMA SELL exit trigger
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_ExitConfirm_BUY = false // Require HMA BUY exit confirmation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_ExitConfirm_SELL = false // Require HMA SELL exit confirmation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for HMA analysis
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_Period = 21 // HMA period
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_ConfirmationBars = 2 // Bars needed for confirmation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_MinSlopeAngle = 0.0001 // Minimum slope angle for trend detection
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_MinMomentumPoints = 5 // Minimum momentum in points
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_RequirePriceAbove = true // Require price above HMA for buy
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_RequirePriceBelow = true // Require price below HMA for sell
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_FilterATRMultiplier = 1.5 // ATR multiplier for noise filter
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_FilterATRPeriod = 14 // ATR period for volatility filter
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_TrendStrengthMin = 0.7 // Minimum trend strength (0-1)
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_SmoothingBars = 3 // Bars for HMA smoothing validation
  • [=== HULL MOVING AVERAGE SETTINGS ===] HMA_MinPriceDistance = 2 // Minimum distance from HMA in points
  • [=== ADDITIONAL FILTERS ===] EnableDelayFilter = false // Enable N-bar delay confirmation filter
  • [=== ADDITIONAL FILTERS ===] BarDelay = 1 // Number of bars delay required for signal confirmation
  • [=== ADDITIONAL FILTERS ===] EntryDelayBars = 1 // Wait this many full new bars before placing a new entry
  • [=== MAGIC INDICATOR SETTINGS ===] UseMagic_Decision = true // Master switch for Magic Decision
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_EntrySignal_BUY = false // Enable Magic BUY entry signal
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_EntrySignal_SELL = false // Enable Magic SELL entry signal
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_Confirm_BUY = false // Require Magic BUY confirmation
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_Confirm_SELL = false // Require Magic SELL confirmation
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_ExitTrigger_BUY = false // Enable Magic BUY exit trigger
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_ExitTrigger_SELL = false // Enable Magic SELL exit trigger
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_ExitConfirm_BUY = false // Require Magic BUY exit confirmation
  • [=== MAGIC INDICATOR SETTINGS ===] Magic_ExitConfirm_SELL = false // Require Magic SELL exit confirmation
  • [=== MAGIC INDICATOR SETTINGS ===] UseAutoFilter = true // Use automatic filter tuning
  • [=== MAGIC INDICATOR SETTINGS ===] Length = 10 // Magic indicator length
  • [=== MAGIC INDICATOR SETTINGS ===] DistanceMultiplier = 0.85 // Distance multiplier for bands
  • [=== MAGIC INDICATOR SETTINGS ===] Timeframe = 0 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Magic indicator timeframe
  • [=== MAGIC INDICATOR SETTINGS ===] TrendFilterTF = 6 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Trend filter timeframe
  • [=== MAGIC INDICATOR SETTINGS ===] TrendEMA = 50 // Trend EMA period
  • [=== MAGIC INDICATOR SETTINGS ===] MinATR = 0.03 // Minimum ATR value
  • [=== MAGIC INDICATOR SETTINGS ===] MinBreakDistance = 0.3 // Minimum break distance
  • [=== TIME ZONE SETTINGS ===] GMT_Offset = 0 // GMT offset for all time filters (hours, +/- from GMT)
  • [=== TIME ZONE SETTINGS ===] UseBrokerTime = false // Use broker time instead of GMT (NOT RECOMMENDED)
  • [=== BASIC TIME FILTERS ===] UseTimeFilter = false // Use basic time filter
  • [=== BASIC TIME FILTERS ===] StartHour = 8 // Start trading hour (GMT + offset)
  • [=== BASIC TIME FILTERS ===] StartMinute = 0 // Start trading minute
  • [=== BASIC TIME FILTERS ===] EndHour = 18 // End trading hour (GMT + offset)
  • [=== BASIC TIME FILTERS ===] EndMinute = 0 // End trading minute
  • [=== TRADING SESSION FILTERS ===] UseSessionFilter = false // Enable trading session filtering
  • [=== TRADING SESSION FILTERS ===] UseSessionOverlapOnly = false // Trade only during session overlaps
  • [=== London Session ===] UseSessionLondon = true // Trade London session
  • [=== London Session ===] LondonStartHour = 8 // London session start hour (GMT + offset)
  • [=== London Session ===] LondonStartMinute = 0 // London session start minute
  • [=== London Session ===] LondonEndHour = 17 // London session end hour (GMT + offset)
  • [=== London Session ===] LondonEndMinute = 0 // London session end minute
  • [=== New York Session ===] UseSessionNewYork = true // Trade New York session
  • [=== New York Session ===] NewYorkStartHour = 13 // New York session start hour (GMT + offset)
  • [=== New York Session ===] NewYorkStartMinute = 0 // New York session start minute
  • [=== New York Session ===] NewYorkEndHour = 22 // New York session end hour (GMT + offset)
  • [=== New York Session ===] NewYorkEndMinute = 0 // New York session end minute
  • [=== Tokyo Session ===] UseSessionTokyo = false // Trade Tokyo session
  • [=== Tokyo Session ===] TokyoStartHour = 0 // Tokyo session start hour (GMT + offset)
  • [=== Tokyo Session ===] TokyoStartMinute = 0 // Tokyo session start minute
  • [=== Tokyo Session ===] TokyoEndHour = 9 // Tokyo session end hour (GMT + offset)
  • [=== Tokyo Session ===] TokyoEndMinute = 0 // Tokyo session end minute
  • [=== Sydney Session ===] UseSessionSydney = false // Trade Sydney session
  • [=== Sydney Session ===] SydneyStartHour = 22 // Sydney session start hour (GMT + offset)
  • [=== Sydney Session ===] SydneyStartMinute = 0 // Sydney session start minute
  • [=== Sydney Session ===] SydneyEndHour = 7 // Sydney session end hour (GMT + offset)
  • [=== Sydney Session ===] SydneyEndMinute = 0 // Sydney session end minute
  • [=== Custom Sessions ===] UseCustomSession1 = false // Enable custom session 1
  • [=== Custom Sessions ===] Custom1StartHour = 10 // Custom session 1 start hour (GMT + offset)
  • [=== Custom Sessions ===] Custom1StartMinute = 0 // Custom session 1 start minute
  • [=== Custom Sessions ===] Custom1EndHour = 16 // Custom session 1 end hour (GMT + offset)
  • [=== Custom Sessions ===] Custom1EndMinute = 0 // Custom session 1 end minute
  • [=== Custom Sessions ===] UseCustomSession2 = false // Enable custom session 2
  • [=== Custom Sessions ===] Custom2StartHour = 15 // Custom session 2 start hour (GMT + offset)
  • [=== Custom Sessions ===] Custom2StartMinute = 0 // Custom session 2 start minute
  • [=== Custom Sessions ===] Custom2EndHour = 21 // Custom session 2 end hour (GMT + offset)
  • [=== Custom Sessions ===] Custom2EndMinute = 0 // Custom session 2 end minute
  • [=== END-OF-DAY FILTERS ===] UseEndOfDayFilter = false // Enable end-of-day position management
  • [=== END-OF-DAY FILTERS ===] EODCloseHour = 22 // End-of-day close hour (GMT + offset)
  • [=== END-OF-DAY FILTERS ===] EODCloseMinute = 0 // End-of-day close minute
  • [=== END-OF-DAY FILTERS ===] PauseNewTradesBeforeEOD = true // Pause new trades before EOD
  • [=== END-OF-DAY FILTERS ===] PauseMinutesBeforeEOD = 30 // Minutes before EOD to pause new trades
  • [=== END-OF-DAY FILTERS ===] EODCloseMode = EOD_CLOSE_NONE // EOD position closing mode
  • [=== END-OF-DAY FILTERS ===] ForceCloseMinutesBeforeEOD = 5 // Minutes before EOD to force close trades
  • [=== END-OF-WEEK FILTERS ===] UseEndOfWeekFilter = false // Enable end-of-week position management
  • [=== END-OF-WEEK FILTERS ===] EOWCloseDay = 5 // End-of-week day (1=Monday, 5=Friday)
  • [=== END-OF-WEEK FILTERS ===] EOWCloseHour = 21 // End-of-week close hour (GMT + offset)
  • [=== END-OF-WEEK FILTERS ===] EOWCloseMinute = 0 // End-of-week close minute
  • [=== END-OF-WEEK FILTERS ===] PauseNewTradesBeforeEOW = true // Pause new trades before EOW
  • [=== END-OF-WEEK FILTERS ===] PauseMinutesBeforeEOW = 60 // Minutes before EOW to pause new trades
  • [=== END-OF-WEEK FILTERS ===] EOWCloseMode = EOW_CLOSE_NONE // EOW position closing mode
  • [=== END-OF-WEEK FILTERS ===] ForceCloseMinutesBeforeEOW = 15 // Minutes before EOW to force close trades
  • [=== TIME-BASED ENTRY CONTROL ===] UseTimeBasedEntryPause = false // Enable time-based entry pause
  • [=== TIME-BASED ENTRY CONTROL ===] EntryPauseAfterPositionClose = 5 // Minutes to pause entries after position close
  • [=== TIME-BASED ENTRY CONTROL ===] AvoidMajorNewsTime = false // Avoid trading during major news
  • [=== TIME-BASED ENTRY CONTROL ===] NewsAvoidanceMinutes = 30 // Minutes to avoid before/after news
  • [=== TIME-BASED ENTRY CONTROL ===] UseDayOfWeekFilter = false // Enable day of week filter
  • [=== TIME-BASED ENTRY CONTROL ===] TradeMonday = true // Trade on Monday
  • [=== TIME-BASED ENTRY CONTROL ===] TradeTuesday = true // Trade on Tuesday
  • [=== TIME-BASED ENTRY CONTROL ===] TradeWednesday = true // Trade on Wednesday
  • [=== TIME-BASED ENTRY CONTROL ===] TradeThursday = true // Trade on Thursday
  • [=== TIME-BASED ENTRY CONTROL ===] TradeFriday = true // Trade on Friday
  • [=== TIME-BASED ENTRY CONTROL ===] AvoidFridayAfterHour = false // Avoid Friday trading after specific hour
  • [=== TIME-BASED ENTRY CONTROL ===] FridayAvoidAfterHour = 16 // Hour to stop Friday trading (GMT + offset)
Pseudocode
// Pipsgrowth EX16061 Trend — Execution Flow (from source analysis)
// Family: Trend
// Optimized Expert Advisor addressing 100+ performance and structure issues, combining RSI entry signals, Momentum Breakout Structure (MBS), Magic indicator and adaptive confirmation for USDJPY with dynamic profit management. 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

Optimized Brokers:
ExnessIC Markets
Optimized Symbols:
XAUUSD
Optimized Timeframes:
M5

How to Install This EA on MT5

  1. 1Download the .mq5 file using the button above
  2. 2Open MetaTrader 5 on your computer
  3. 3Click File → Open Data Folder in the top menu
  4. 4Navigate to MQL5 → Experts and paste the .mq5 file there
  5. 5In MT5, right-click Expert Advisors in the Navigator panel → Refresh
  6. 6Drag the EA onto an H4 or Daily chart for best results
  7. 7Configure EMA periods, ADX threshold, and lot size in the dialog
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
EnableTradingtrueEnable trading
EnableDebugfalseEnable debug logging
LotSize0.01Fixed lot size
MagicNumber22216061Magic number
InpTradeComment"Psgrowth.com Expert_16061"Trade comment
Slippage3Slippage in points
MaxSpread30.0Maximum spread in points
MaxDrawdownPercent10.0Maximum drawdown percentage
MaxRiskPerTrade2.0Maximum risk per trade %
MaxOpenTrades5Maximum open trades
StopLossPoints100.0Stop loss in points
TakeProfitPoints200.0Take profit in points
EnableDynamicLockProfittrueEnable dynamic profit locking
LockProfitEvery_X_Points30.0Step: every X points profit
LockMinusBuffer15.0Lock profit minus X point buffer
AllowOnlyProfitableAdditionstrueOnly allow adding positions if existing trades are profitable
MinProfitInPointsPerTradeToAdd20.0Minimum profit required per existing trade in points
RSI_EntrySignal_BUYfalseEnable RSI BUY entry signal
RSI_EntrySignal_SELLfalseEnable RSI SELL entry signal
RSI_Confirm_BUYfalseRequire RSI BUY confirmation
RSI_Confirm_SELLfalseRequire RSI SELL confirmation
RSI_ExitTrigger_BUYfalseEnable RSI BUY exit trigger
RSI_ExitTrigger_SELLfalseEnable RSI SELL exit trigger
RSI_ExitConfirm_BUYfalseRequire RSI BUY exit confirmation
RSI_ExitConfirm_SELLfalseRequire RSI SELL exit confirmation
RSI_TF0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for RSI
RSI_Period14RSI period
RSI_Price1Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // Applied price for RSI
RSI_Overbought70.0RSI overbought level
RSI_Oversold30.0RSI oversold level
RSI_SignalShift0Shift for RSI signal line
RSI_Midline50RSI midline level
RSI_ExtremeBuffer5Buffer for extreme levels
RSI_MinRange5.0Minimum RSI range for valid signal
RSI_MinVolatility2.0Minimum volatility threshold
RSI_MomentumBars3Bars for momentum confirmation
RSI_DeadZoneSize5.0Dead zone around midline
MBS_EntrySignal_BUYtrueEnable MBS BUY entry signal
MBS_EntrySignal_SELLtrueEnable MBS SELL entry signal
MBS_Confirm_BUYfalseRequire MBS BUY confirmation
MBS_Confirm_SELLfalseRequire MBS SELL confirmation
MBS_ExitTrigger_BUYfalseEnable MBS BUY exit trigger
MBS_ExitTrigger_SELLfalseEnable MBS SELL exit trigger
MBS_ExitConfirm_BUYfalseRequire MBS BUY exit confirmation
MBS_ExitConfirm_SELLfalseRequire MBS SELL exit confirmation
MBS_Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for analysis
MBS_LookbackBars20Lookback period for structure analysis
MBS_MinBreakoutSize50Minimum breakout size in points
MBS_MomentumThreshold0.7Momentum strength threshold (0-1)
MBS_ConfirmationBars2Bars needed for confirmation
MBS_VolatilityFilter1.5Volatility filter multiplier
MBS_TrendStrengthMin0.6Minimum trend strength (0-1)
MBS_RequireVolumeSpiketrueRequire volume confirmation
MBS_VolumeMultiplier1.5Volume spike multiplier
MBS_ATRPeriod14ATR period for volatility
MBS_ATRMultiplier1.0ATR multiplier for breakout validation
MBS_EMAPeriod21EMA period for trend direction
MBS_MinPriceMovement0.0001Minimum price movement for signal
DC_EntrySignal_BUYtrueEnable Donchian Channel BUY entry signal
DC_EntrySignal_SELLtrueEnable Donchian Channel SELL entry signal
DC_Confirm_BUYfalseRequire Donchian Channel BUY confirmation
DC_Confirm_SELLfalseRequire Donchian Channel SELL confirmation
DC_ExitTrigger_BUYfalseEnable Donchian Channel BUY exit trigger
DC_ExitTrigger_SELLfalseEnable Donchian Channel SELL exit trigger
DC_ExitConfirm_BUYfalseRequire Donchian Channel BUY exit confirmation
DC_ExitConfirm_SELLfalseRequire Donchian Channel SELL exit confirmation
DC_Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for Donchian Channel
DC_ChannelPeriod20Lookback period for channel
DC_ConfirmationBars2Bars needed for confirmation
DC_MinBreakoutPoints10Minimum breakout size in points
DC_ATRMultiplier1.0ATR multiplier for volatility filter
DC_ATRPeriod14ATR period for volatility
DC_RequireVolumeSpikefalseRequire volume spike confirmation
DC_VolumeMultiplier1.5Volume spike multiplier
DC_MinPullbackPoints5Minimum pullback before breakout
DC_MinRangePoints20Minimum channel range to avoid chop
HMA_EntrySignal_BUYfalseEnable HMA BUY entry signal
HMA_EntrySignal_SELLfalseEnable HMA SELL entry signal
HMA_Confirm_BUYfalseRequire HMA BUY confirmation
HMA_Confirm_SELLfalseRequire HMA SELL confirmation
HMA_ExitTrigger_BUYfalseEnable HMA BUY exit trigger
HMA_ExitTrigger_SELLfalseEnable HMA SELL exit trigger
HMA_ExitConfirm_BUYfalseRequire HMA BUY exit confirmation
HMA_ExitConfirm_SELLfalseRequire HMA SELL exit confirmation
HMA_Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Timeframe for HMA analysis
HMA_Period21HMA period
HMA_ConfirmationBars2Bars needed for confirmation
HMA_MinSlopeAngle0.0001Minimum slope angle for trend detection
HMA_MinMomentumPoints5Minimum momentum in points
HMA_RequirePriceAbovetrueRequire price above HMA for buy
HMA_RequirePriceBelowtrueRequire price below HMA for sell
HMA_FilterATRMultiplier1.5ATR multiplier for noise filter
HMA_FilterATRPeriod14ATR period for volatility filter
HMA_TrendStrengthMin0.7Minimum trend strength (0-1)
HMA_SmoothingBars3Bars for HMA smoothing validation
HMA_MinPriceDistance2Minimum distance from HMA in points
EnableDelayFilterfalseEnable N-bar delay confirmation filter
BarDelay1Number of bars delay required for signal confirmation
EntryDelayBars1Wait this many full new bars before placing a new entry
UseMagic_DecisiontrueMaster switch for Magic Decision
Magic_EntrySignal_BUYfalseEnable Magic BUY entry signal
Magic_EntrySignal_SELLfalseEnable Magic SELL entry signal
Magic_Confirm_BUYfalseRequire Magic BUY confirmation
Magic_Confirm_SELLfalseRequire Magic SELL confirmation
Magic_ExitTrigger_BUYfalseEnable Magic BUY exit trigger
Magic_ExitTrigger_SELLfalseEnable Magic SELL exit trigger
Magic_ExitConfirm_BUYfalseRequire Magic BUY exit confirmation
Magic_ExitConfirm_SELLfalseRequire Magic SELL exit confirmation
UseAutoFiltertrueUse automatic filter tuning
Length10Magic indicator length
DistanceMultiplier0.85Distance multiplier for bands
Timeframe0Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Magic indicator timeframe
TrendFilterTF6Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // Trend filter timeframe
TrendEMA50Trend EMA period
MinATR0.03Minimum ATR value
MinBreakDistance0.3Minimum break distance
GMT_Offset0GMT offset for all time filters (hours, +/- from GMT)
UseBrokerTimefalseUse broker time instead of GMT (NOT RECOMMENDED)
UseTimeFilterfalseUse basic time filter
StartHour8Start trading hour (GMT + offset)
StartMinute0Start trading minute
EndHour18End trading hour (GMT + offset)
EndMinute0End trading minute
UseSessionFilterfalseEnable trading session filtering
UseSessionOverlapOnlyfalseTrade only during session overlaps
UseSessionLondontrueTrade London session
LondonStartHour8London session start hour (GMT + offset)
LondonStartMinute0London session start minute
LondonEndHour17London session end hour (GMT + offset)
LondonEndMinute0London session end minute
UseSessionNewYorktrueTrade New York session
NewYorkStartHour13New York session start hour (GMT + offset)
NewYorkStartMinute0New York session start minute
NewYorkEndHour22New York session end hour (GMT + offset)
NewYorkEndMinute0New York session end minute
UseSessionTokyofalseTrade Tokyo session
TokyoStartHour0Tokyo session start hour (GMT + offset)
TokyoStartMinute0Tokyo session start minute
TokyoEndHour9Tokyo session end hour (GMT + offset)
TokyoEndMinute0Tokyo session end minute
UseSessionSydneyfalseTrade Sydney session
SydneyStartHour22Sydney session start hour (GMT + offset)
SydneyStartMinute0Sydney session start minute
SydneyEndHour7Sydney session end hour (GMT + offset)
SydneyEndMinute0Sydney session end minute
UseCustomSession1falseEnable custom session 1
Custom1StartHour10Custom session 1 start hour (GMT + offset)
Custom1StartMinute0Custom session 1 start minute
Custom1EndHour16Custom session 1 end hour (GMT + offset)
Custom1EndMinute0Custom session 1 end minute
UseCustomSession2falseEnable custom session 2
Custom2StartHour15Custom session 2 start hour (GMT + offset)
Custom2StartMinute0Custom session 2 start minute
Custom2EndHour21Custom session 2 end hour (GMT + offset)
Custom2EndMinute0Custom session 2 end minute
UseEndOfDayFilterfalseEnable end-of-day position management
EODCloseHour22End-of-day close hour (GMT + offset)
EODCloseMinute0End-of-day close minute
PauseNewTradesBeforeEODtruePause new trades before EOD
PauseMinutesBeforeEOD30Minutes before EOD to pause new trades
EODCloseModeEOD_CLOSE_NONEEOD position closing mode
ForceCloseMinutesBeforeEOD5Minutes before EOD to force close trades
UseEndOfWeekFilterfalseEnable end-of-week position management
EOWCloseDay5End-of-week day (1=Monday, 5=Friday)
EOWCloseHour21End-of-week close hour (GMT + offset)
EOWCloseMinute0End-of-week close minute
PauseNewTradesBeforeEOWtruePause new trades before EOW
PauseMinutesBeforeEOW60Minutes before EOW to pause new trades
EOWCloseModeEOW_CLOSE_NONEEOW position closing mode
ForceCloseMinutesBeforeEOW15Minutes before EOW to force close trades
UseTimeBasedEntryPausefalseEnable time-based entry pause
EntryPauseAfterPositionClose5Minutes to pause entries after position close
AvoidMajorNewsTimefalseAvoid trading during major news
NewsAvoidanceMinutes30Minutes to avoid before/after news
UseDayOfWeekFilterfalseEnable day of week filter
TradeMondaytrueTrade on Monday
TradeTuesdaytrueTrade on Tuesday
TradeWednesdaytrueTrade on Wednesday
TradeThursdaytrueTrade on Thursday
TradeFridaytrueTrade on Friday
AvoidFridayAfterHourfalseAvoid Friday trading after specific hour
FridayAvoidAfterHour16Hour to stop Friday trading (GMT + offset)
Source Code (.mq5)Open Source
Pipsgrowth_com_EX16061.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX16061 OptimizedEA -- Optimized multi-indicator EA with RSI, MBS, Magic indicator and adaptive confirmation, full 12-layer stack."
#include <Trade/Trade.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/OrderInfo.mqh>

//+------------------------------------------------------------------+
//| Input Parameters - Organized and Validated                      |
//+------------------------------------------------------------------+
ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
   switch(tf)
   {
      case 1: return PERIOD_M1;
      case 2: return PERIOD_M5;
      case 3: return PERIOD_M15;
      case 4: return PERIOD_M30;
      case 5: return PERIOD_H1;
      case 6: return PERIOD_H4;
      case 7: return PERIOD_D1;
      default: return PERIOD_H1;
   }
}
ENUM_APPLIED_PRICE MapAppliedPriceInt(int ap)
{
   switch(ap)
   {
      case 1: return PRICE_CLOSE;
      case 2: return PRICE_OPEN;
      case 3: return PRICE_HIGH;
      case 4: return PRICE_LOW;
      case 5: return PRICE_MEDIAN;
      case 6: return PRICE_TYPICAL;
      case 7: return PRICE_WEIGHTED;
      default: return PRICE_CLOSE;
   }
}
ENUM_TIMEFRAMES g_RSI_TF = PERIOD_H1;
ENUM_TIMEFRAMES g_MBS_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_DC_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_HMA_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_Timeframe = PERIOD_H1;
ENUM_TIMEFRAMES g_TrendFilterTF = PERIOD_H1;
ENUM_APPLIED_PRICE g_RSI_Price = PRICE_CLOSE;
input group "=== BASIC SETTINGS ==="
input bool     EnableTrading = true;                    // Enable trading
input bool     EnableDebug = false;                     // Enable debug logging
input double   LotSize = 0.01;                         // Fixed lot size
input int      MagicNumber = 22216061;                   // Magic number
input string           InpTradeComment = "Psgrowth.com Expert_16061";   // Trade comment
input int      Slippage = 3;                           // Slippage in points

ENUM_TIMEFRAMES MapTimeframeInt(int tf)
{
   switch(tf)
   {
      case 1: return PERIOD_M1;

Full source code available on download

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

Tags:ex16061trendpipsgrowthfreemt5xauusd

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

Community

Sign in to contributeSign In

Educational purposes only. Do NOT use with real money. Test on demo accounts only.

File NamePipsgrowth_com_EX16061.mq5
File Size178.3 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyTrend Following
Risk LevelMedium Risk
Timeframes
M5
Currency Pairs
XAUUSD
Min. Deposit$100