P
PipsGrowth
OtherOpen Source – Free

Pipsgrowth EX01014 Adaptive

MT5 Expert Advisor (Open Source) · EURUSD · M1, M15

Pipsgrowth.com EX01014 EX10 Hurst-Delta Adaptive Microstructure Scalper — BB+RSI mean-reversion scalper, full 12-layer stack.

Overview

Pipsgrowth EX01014 is a microstructure scalper built around a single idea: when price walks out of a Bollinger envelope and the RSI confirms the move is exhausted, fade the excursion. Two indicators do all the heavy lifting — iBands(20, 2.0) on close prices and iRSI(14) — and the rest of the codebase is plumbing around them: indicator handles, order retries, session windows, and a deep safety stack.

The decision is made bar by bar, not tick by tick. The GetSignals() function pulls the previous closed bar's upper and lower Bollinger band plus the previous bar's RSI, then asks one question: did the close print at or beyond the band while the oscillator sat at the matching extreme? Specifically, a long consideration fires when the close is at or below the lower Bollinger band AND the RSI(14) is at or below 35. A short consideration fires when the close is at or above the upper band AND the RSI is at or above 65. The default bands are the standard 20-period, 2.0-deviation envelope, so the bar must clear the band before the signal is even considered. RSI does not enter first — the band is the gate, the oscillator is the confirmation. If both buy and sell fire on the same bar (a wick that touched both sides), TrySymbol() discards both signals and waits for the next bar.

Execution is where the rest of the engine comes in. By default the EA works as a single-symbol, single-timeframe robot on whatever chart you attach it to. The InpSymbolsCSV and InpEnableMultiSymbol inputs flip it into a portfolio mode: a CSV string such as "EURUSD,GBPUSD,USDJPY" is parsed by SplitCSV() into up to 16 symbols, each tracked in its own SymState struct with its own Bollinger and RSI handles, its own loss-streak counter, its own last-trade timestamp, and its own per-symbol pause flag. When multi-symbol mode is on, the engine runs through OnTimer() at the InpTimerSeconds interval (1 second by default) instead of OnTick(). The tick handler is reserved for the single-symbol path. Either way, the work happens in TrySymbol(si), which ensures the handles are created, checks that the symbol is not paused, validates the spread, and only then pulls signals.

The order layer is built to handle thin liquidity. SendOrder() calls GetBestFillingMode() first to read what the broker advertises — IOC, FOK, or RETURN — and submits with that mode. Three attempts are made; on a requote, timeout, price-off, or price-changed retcode, the function sleeps 100ms and retries. Margin is checked before submission via OrderCalcMargin(); if free margin is short, the order is refused without sending. Stops are normalized to the symbol's tick size via NormalizePriceToTick(), and any stop or take-profit that falls inside the broker's SYMBOL_TRADE_STOPS_LEVEL is pushed out to the minimum allowed distance.

Position management is intentionally minimal. Once a position is open, the EA does not trail it, does not scale it, does not hedge it. The 250-point stop and 500-point take-profit are absolute price distances from the entry, not trailing. The fixed 0.10 lot means every entry risks the same amount, and the 1:2 reward-to-risk ratio is hard-coded into the SL/TP pair rather than computed from the structure. The chart-side BUY ON/OFF and SELL ON/OFF buttons let you disable a direction at runtime without recompiling — they live as OBJ_BUTTON objects on the chart and are toggled by clicks through OnChartEvent().

What the EA does stack, very deliberately, is protection. Eight separate guards run before any signal can reach the order layer. IsSafeToTrade() checks: capital cap (if InpCapAmount is set, refuse to open new positions above it), capital floor (refuse below InpCapFloor, default $100), equity protection (refuse when equity drops below 80% of initial balance), daily loss limit (refuse when realized losses hit 3% of initial balance), weekly loss limit (8% of initial), consecutive-loss cooldown (after 3 losses, block for 30 minutes), trades-per-day ceiling (50), kill switch (manual or automatic at 20% drawdown), market-open check (no Saturday, no Sunday before 22:00 GMT, no Friday after 22:00 minus 5 minutes), session check (London 7–16 GMT and New York 12–21 GMT only, Asian session 0–7 GMT blocked), and news blackout (a 30-minute window around the London and New York opens). Each guard is a separate line in the function and each prints its reason when it fires.

The two-tier loss-streak system is worth flagging. OnClosedDeal() runs on every TRADE_TRANSACTION_DEAL_ADD; if the deal is an exit for this magic and is a loss, it increments both the per-symbol lossStreak and the global g_consecLosses. When the per-symbol count hits InpLossStreakCount (3 by default), the per-symbol pauseUntil is set to TimeCurrent() + InpLossStreakPauseMin*60 (60 minutes). The same trade also pushes the global cooldown to 30 minutes if InpCooldownMin > 0. Both pause timers are evaluated in TrySymbol() and IsSafeToTrade() respectively, so the EA can trade a different symbol while one is paused, but cannot trade any symbol during a global cooldown.

For testing, the OnTester() function applies a hard gate before scoring: if drawdown exceeds 20%, total trades are below 20, or net profit is non-positive, the function returns 0 and the optimization pass is discarded. Otherwise, it returns profit × profitFactor × ddPenalty where ddPenalty = 1 / (1 + maxDD/10). The intent is to favour profit factors in backtests that also respect drawdown — raw profit at the cost of equity erosion is not rewarded. The EA is meant to be optimized on M1 with realistic spread assumptions, and the 35-point spread cap is the lever to use to force the optimizer away from high-spread periods.

In live use, expect a high trade count (up to 50 per day on a single symbol during a busy session) and most weeks to be flat or slightly positive. The 1:2 reward-to-risk and the loss-streak pauses are designed to keep drawdown inside the 20% kill switch. The strategy is non-trending and performs best in FX pairs with persistent intraday range — EURUSD is the default. M1 is the published timeframe but the source allows 1 through 7 (M1, M5, M15, M30, H1, H4, D1); the signal does not change with timeframe, only the frequency.

Strategy Deep Dive

The engine arms on every timer tick (1 second by default) in multi-symbol mode, or on every price tick in single-symbol mode. TrySymbol() ensures each symbol's Bollinger and RSI handles exist, then calls GetSignals() to test the previous closed bar's close against the band and the oscillator against the extreme threshold. If exactly one side fires, the order is sent via SendOrder() with three retries on requote/timeout/price-changed retcodes, automatic filling-mode detection, and a margin pre-check. OnClosedDeal() watches for filled exits and feeds the loss-streak and consecutive-loss counters, which then drive the per-symbol and global cooldowns. IsSafeToTrade() runs eight separate gates — capital cap/floor, equity, daily loss, weekly loss, cooldown, market open, session, and news — before any signal can reach execution.

Entry Signal

Mean-reversion entries: long when previous-bar close prints at or below the lower Bollinger band (20-period, 2.0 dev) AND RSI(14) is at or below 35; short when previous-bar close is at or above the upper band AND RSI is at or above 65. Both signals firing on the same bar are discarded. Direction is gated by the per-symbol cooldown (20s by default) and the one-entry-per-bar flag.

Exit Signal

Each entry has a fixed 500-point take-profit and 250-point stop-loss, giving a hard-coded 1:2 reward-to-risk. There is no trailing stop, no breakeven move, and no manual close — the position is held until either the SL or TP hits, or the position is closed externally. A direction toggle (BUY ON/OFF / SELL ON/OFF buttons) prevents new entries but does not close existing positions.

Stop Loss

Fixed 250-point stop-loss from entry, normalized to the symbol's tick size and pushed out to the broker's minimum stop distance when needed. There is no per-trade trailing, no breakeven shift, and no basket-level stop — the SL only resets when a new position is opened.

Take Profit

Fixed 500-point take-profit, paired with the 250-point SL for a 1:2 RR. No scaling, no partial closes, no multi-level TP — the position closes in one shot when price hits the TP price. The TP distance is enforced on entry and never modified afterward.

Best For

Best on EURUSD M1 with a low-spread ECN broker; the 35-point spread cap assumes sub-pip spreads. Minimum recommended balance is $100 to clear the capital floor and absorb the 250-point SL on a 0.10 lot. Designed for traders who want a high-frequency mean-reversion robot with hard guardrails — capital cap/floor, 80% equity protection, 3% daily loss limit, 8% weekly, 20% drawdown kill switch, and a 60-minute pause after 3 consecutive losses per symbol. Ideal session is the London–New York overlap (12:00–16:00 GMT) where the band extremes are most frequently meaningful.

Strategy Logic

Pipsgrowth EX01014 Adaptive — Strategy Logic Analysis (from .mq5 source)

Family: Adaptive Magic: 22201014 Version: 2.00

BRIEF: Hurst-Delta adaptive microstructure scalper using Bollinger Band mean-reversion signals confirmed by RSI extremes. Multi- symbol capable, spread cap, loss-streak pause, one-entry-per-bar 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • CreateOrUpdateButton()
  • RefreshDirectionButtons()
  • Trim()
  • SplitCSV()
  • FindSym()
  • SymPoint()
  • SymBid()
  • SymAsk()
  • NormalizeVol()
  • NormalizePriceToTick()
  • SpreadOK()
  • SendOrder()
  • ...and 15 more

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (47 total across 12 groups):

  • [=== Engine ===] InpSymbolsCSV = "EURUSD" // symbol list (CSV) or _Symbol if disabled
  • [=== Engine ===] InpEnableMultiSymbol = false // enable multi-symbol loop
  • [=== Engine ===] InpTF = 1 // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // working timeframe
  • [=== Engine ===] InpUseTimerEngine = true // use OnTimer instead of per-tick for multi-symbol
  • [=== Engine ===] InpTimerSeconds = 1 // timer interval seconds
  • [=== Identification ===] InpMagic = 22201014 // magic number
  • [=== Identification ===] InpTradeComment = "Psgrowth.com Expert_01014" // order comment prefix
  • [=== Risk & Execution ===] InpFixedLot = 0.10 // fixed lot size
  • [=== Risk & Execution ===] InpSL_Points = 250 // stop-loss in points
  • [=== Risk & Execution ===] InpTP_Points = 500 // take-profit in points
  • [=== Risk & Execution ===] InpSlippagePoints = 5 // max slippage (points)
  • [=== Risk & Execution ===] InpOneEntryPerBar = true // restrict to one entry per bar
  • [=== Risk & Execution ===] InpCooldownSeconds = 20 // side-specific cooldown seconds
  • [=== Direction Enable ===] InpEnableBuy = true // allow long entries
  • [=== Direction Enable ===] InpEnableSell = true // allow short entries
  • [=== Mean Reversion Signals ===] InpBB_Period = 20 // Bollinger period
  • [=== Mean Reversion Signals ===] InpBB_Dev = 2 // Bollinger deviation (integer)
  • [=== Mean Reversion Signals ===] InpRSI_Period = 14 // RSI period
  • [=== Mean Reversion Signals ===] InpRSI_BuyLvl = 35 // RSI <= triggers buy consideration
  • [=== Mean Reversion Signals ===] InpRSI_SellLvl = 65 // RSI >= triggers sell consideration
  • [=== Filters ===] InpUseSpreadCap = true // enable fixed spread cap
  • [=== Filters ===] InpSpreadCapAbsPoints = 35 // max allowed spread (points)
  • [=== Loss Pause ===] InpPauseOnLossStreak = true // pause trading on consecutive losses
  • [=== Loss Pause ===] InpLossStreakCount = 3 // losses before pause
  • [=== Loss Pause ===] InpLossStreakPauseMin = 60 // pause minutes
  • [=== Risk Management ===] MaxDailyLossPercent = 3.0 // Maximum daily loss percentage
  • [=== Risk Management ===] MaxTradesPerDay = 50 // Maximum trades per day (global)
  • [=== 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 // Server GMT offset 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
  • [=== Logging ===] InpVerbose = false // verbose logging
Pseudocode
// Pipsgrowth EX01014 Adaptive — Execution Flow (from source analysis)
// Family: Adaptive
// Hurst-Delta adaptive microstructure scalper using Bollinger Band mean-reversion signals confirmed by RSI extremes. Multi- symbol capable, spread cap, loss-streak pause, one-entry-per-bar 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:
EURUSD
Optimized Timeframes:
M1M15

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 a chart matching the recommended timeframe
  7. 7Configure parameters according to the table on this page
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
InpSymbolsCSV"EURUSD"symbol list (CSV) or _Symbol if disabled
InpEnableMultiSymbolfalseenable multi-symbol loop
InpTF1Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1) // working timeframe
InpUseTimerEnginetrueuse OnTimer instead of per-tick for multi-symbol
InpTimerSeconds1timer interval seconds
InpMagic22201014magic number
InpTradeComment"Psgrowth.com Expert_01014"order comment prefix
InpFixedLot0.10fixed lot size
InpSL_Points250stop-loss in points
InpTP_Points500take-profit in points
InpSlippagePoints5max slippage (points)
InpOneEntryPerBartruerestrict to one entry per bar
InpCooldownSeconds20side-specific cooldown seconds
InpEnableBuytrueallow long entries
InpEnableSelltrueallow short entries
InpBB_Period20Bollinger period
InpBB_Dev2Bollinger deviation (integer)
InpRSI_Period14RSI period
InpRSI_BuyLvl35RSI <= triggers buy consideration
InpRSI_SellLvl65RSI >= triggers sell consideration
InpUseSpreadCaptrueenable fixed spread cap
InpSpreadCapAbsPoints35max allowed spread (points)
InpPauseOnLossStreaktruepause trading on consecutive losses
InpLossStreakCount3losses before pause
InpLossStreakPauseMin60pause minutes
MaxDailyLossPercent3.0Maximum daily loss percentage
MaxTradesPerDay50Maximum trades per day (global)
MinEquityPercent80.0Stop trading if equity falls below this % of initial balance
InpMaxConsecLosses3Max consecutive losses before cooldown (0=disabled)
InpCooldownMin30Cooldown minutes after consec losses (0=disabled)
InpMaxWeeklyLossPct8.0Max weekly loss % (0=disabled)
InpCapAmount0.0Capital cap amount (stop trading at this equity)
InpCapFloor100.0Capital floor (stop trading below this equity)
InpServerGMTOffset0Server GMT offset in hours (0=auto-detect via weekend gap)
InpLondonStartHour7London session start (GMT)
InpLondonEndHour16London session end (GMT)
InpNYStartHour12New York session start (GMT)
InpNYEndHour21New York session end (GMT)
InpAvoidAsiatrueAvoid Asian session
InpAsiaStartHour0Asian session start (GMT)
InpAsiaEndHour7Asian session end (GMT)
AvoidNewstrueAvoid trading during news
InpMaxDDPct20.0Max total drawdown % (0=disabled, triggers kill switch)
InpKillSwitchfalseKill switch (stops all trading immediately)
InpDryRunfalseDry-run mode: log signals without trading
InpMaxLot100.0Maximum lot size cap
InpVerbosefalseverbose logging
Source Code (.mq5)Open Source
Pipsgrowth_com_EX01014.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX01014 EX10 Hurst-Delta Adaptive Microstructure Scalper — BB+RSI mean-reversion scalper, full 12-layer stack."

//------------------ GROUPED INPUTS ------------------//
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_InpTF = PERIOD_H1;
input group   "=== Engine ==="
input string  InpSymbolsCSV         = "EURUSD";   // symbol list (CSV) or _Symbol if disabled
input bool    InpEnableMultiSymbol  = false;       // enable multi-symbol loop
input int InpTF = 1; // Timeframe (1=M1,2=M5,3=M15,4=M30,5=H1,6=H4,7=D1)   // working timeframe
input bool    InpUseTimerEngine     = true;        // use OnTimer instead of per-tick for multi-symbol
input int     InpTimerSeconds       = 1;           // timer interval seconds

input group   "=== Identification ==="
input int     InpMagic              = 22201014;       // magic number
input string  InpTradeComment       = "Psgrowth.com Expert_01014";      // order comment prefix

input group   "=== Risk & Execution ==="
input double  InpFixedLot           = 0.10;        // fixed lot size
input int     InpSL_Points          = 250;         // stop-loss in points
input int     InpTP_Points          = 500;         // take-profit in points
input int     InpSlippagePoints     = 5;           // max slippage (points)
input bool    InpOneEntryPerBar     = true;        // restrict to one entry per bar
input int     InpCooldownSeconds    = 20;          // side-specific cooldown seconds

input group   "=== Direction Enable ==="
input bool    InpEnableBuy          = true;        // allow long entries
input bool    InpEnableSell         = true;        // allow short entries

Full source code available on download

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

Tags:ex01014adaptivepipsgrowthfreemt5eurusd

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_EX01014.mq5
File Size23.8 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyOther
Risk LevelMedium Risk
Timeframes
M1M15
Currency Pairs
EURUSD
Min. Deposit$100