P
PipsGrowth
GridOpen Source – Free

Pipsgrowth EX03025 Grid

MT5 Expert Advisor (Open Source) · AUDUSD · M5

Pipsgrowth.com EX03025 DHLAOS — Daily High/Low + Andean Oscillator scalping with grid, full 12-layer stack.

Overview

Pipsgrowth EX03025 Grid is a counter-trend scalper that fires after intraday extremes, built on a custom Andean Oscillator (AOS) computed in-EA rather than pulled from an iCustom handle. The trade is fade-the-dip: long when the AOS Bull line crosses back up through its Signal while a recent bar in the lookback window has slipped below the running daily low, and the mirror image for shorts. The oscillator and the daily extremes are both rebuilt every new bar from raw price data, so the strategy's view of the market is rebuilt 288 times a day on M5 and never accumulates stale state from prior days.

The two AOS components, Bull and Bear, are calculated inside ComputeAndeanOscillator() over BuffSize = AosNCheck + DhlNCheck + 2 = 352 bars. The function maintains a running max of highs and a running min of lows through the lookback, then constructs Bull = close + alpha * (high_max - close) and Bear = close - alpha * (close - low_min), with alpha = 2 / (AosPeriod + 1) = 2/51. Both series are then EMA-smoothed in place with the same alpha, and a Signal line is the EMA of Bull at the faster alpha = 2 / (AosSignalPeriod + 1) = 2/10. The three output arrays are sized to 352 and indexed in series mode. There are no iCustom handles, no chart subwindow, and no companion indicator — the oscillator lives only in EA memory.

The entry engine in BuySignal() reads the crossover at bar 1: AOS_Bull[2] <= AOS_Signal[2] AND AOS_Bull[1] > AOS_Signal[1] — Bull turning up through Signal. The function then walks backward from bar 3 up to AosNCheck = 300 bars, looking for the most recent pivot where Bull was last below Bear and below Signal at the same close (a swing low in the oscillator). The bar where that pivot lands becomes j. From j forward through DhlNCheck = 50 bars, the engine checks whether any bar's high sat below the running daily low stored in DHL_L[i] while the AOS was still in bear configuration (Bull below Bear). When both conditions hold, a market buy is dispatched through ea.BuyOpen(). SellSignal() is the symmetric mirror, gated on Bear crossing up through Signal, a recent bar above the running daily high, and Bull above Bear at that bar.

Daily High/Low is built by ComputeDailyHighLow() walking the same 352 bars, resetting dayHigh and dayLow whenever the calendar day changes (compared through MqlDateTime). The arrays DHL_H[] and DHL_L[] are series-indexed. Because the running extremes include the current bar, the extreme-bar filter inside BuySignal()/SellSignal() is a stringent condition that selects only setups where the daily range has been violated by the bar's high/low relative to the running low/high — a deliberate guard against entering on shallow pullbacks.

SL and TP are calculated but, by default, not attached. BuySL(SLType=SL_SWING, SLLookback=7, SLDev=60) returns a swing-based stop with 60 points of allowed deviation, and TP = entry + TPCoef * |entry - SL| = 1.5R. Both are passed into ea.BuyOpen() along with IgnoreSL = true and IgnoreTP = true, so the framework does not attach them as order-level protection. The only mechanical exit is the trailing stop, applied every 30 seconds from OnTimer(). TrailingStopLevel = 50 (i.e. 50% of the framework's profit-distance basis) ratchets the stop behind the trade as it moves in favor. There is no time-based exit and no opposite-signal exit inside the entry functions — the trade runs until the trail closes it, the equity stop fires, or the grid basket closes.

The grid layer is off by default (Grid = false). When enabled, GridMaxLvl = 50 layers are allowed per side, GridVolMult = 1.1 scales each additional layer's lot, and GridTrailingStopLevel = 20% applies a separate, tighter trailing to the basket. With the grid off, the EA is a single-shot, no-SL, no-TP, trailing-only mean-reversion trade. With the grid on, the EA accumulates a recovery ladder up to 50 deep on each side, and the basket can survive deeper adverse moves before the equity stop triggers.

Pre-trade gating in OnTick() runs once per new bar (lastCandle is compared against iTime of the current bar). The gates in order are: OpenNewPos must be true, spread must be at or below SpreadLimit (default -1 disables the filter), margin level must be at or above MarginLimit = 300% if any position is open, and if Grid is on or MultipleOpenPos is off, the EA blocks new entries while a position is open. BuySignal() is tried first, then SellSignal() if the buy fails. There is no time-of-day filter, no day-of-week filter, and no session window — entries can fire on any bar that meets the conditions, including the Asian session or the NY rollover.

The news filter (News = false by default) is wired but inert. When toggled on, fetchCalendarFromYear(NewsStartYear) is called in OnInit() and the EA gates entries for NewsMinsBefore = 60 minutes before through NewsMinsAfter = 60 minutes after any event at NewsImportance = MEDIUM or higher. With News off, the EA fires on every qualifying bar regardless of macro calendar, which is a meaningful difference for traders running this on AUDUSD around RBA / AU CPI / China data.

The risk engine sizes each trade at Risk = 0.5% of equity per entry under RiskMode = RISK_DEFAULT, scaling the lot to the SL distance computed by BuySL. With IgnoreSL = true, the lot is sized to a stop distance the framework calculated but did not attach, so the actual per-trade dollar risk is the framework's interpretation of the swing stop. EquityDrawdownLimit = 0 disables the global equity stop; setting it to e.g. 20 engages ea.CheckForEquity() to flatten when equity drops 20% from peak. Slippage = 30 points is passed to the trade request. Magic 22203025 and the comment 'Psgrowth.com Expert_03025' identify the EA's own orders on the account.

This is a contrarian / mean-reversion EA, not a breakout despite the brief. The setup is 'AOS turns up, daily low was just violated, go long' — fade-the-dip. The combination of no per-trade SL, no per-trade TP, and trailing-only management means losers can run deep before the trail catches up, which is consistent with the VERY_HIGH risk level. On AUDUSD M5 with default settings, the EA produces a low-frequency signal stream (the daily-low-violation filter is exacting) and rides each trade for many bars. The grid option exists for traders who want to convert a single-shot mean-reversion into a martingale-style recovery, but the default config does not.

The expected backtest profile on AUDUSD M5 is sparse entries with mixed R-multiple outcomes. Winners can be substantial when the trail runs for an extended move, and losers can be small because the trail typically closes at a slight loss or breakeven if the setup fails quickly. The combination of contrarian entries and trailing-only management tends to produce equity curves that chop during directional days and trend during range days. With the grid enabled, the curve's drawdown profile shifts to depend on how deep adverse moves run and whether the equity stop is engaged before the basket recovers.

Strategy Deep Dive

On every new M5 bar, the EA rebuilds the Andean Oscillator and the daily high/low arrays from raw price data, then runs BuySignal() and SellSignal() in sequence. ComputeAndeanOscillator() maintains running max/min over 352 bars and produces three series — AOS_Bull, AOS_Bear, and AOS_Signal — using a 2/(AosPeriod+1) smoothing on Bull and Bear plus a faster 2/(AosSignalPeriod+1) smoothing on the Signal line. ComputeDailyHighLow() walks the same 352 bars and resets the running dayHigh/dayLow when the calendar day changes. BuySignal() looks for AOS_Bull crossing above Signal at bar 1, then walks backward up to 300 bars to find the most recent AOS swing low, then scans the next 50 bars for a high below the running daily low while AOS_Bull was below AOS_Bear — a stringent filter that only passes setups where the daily range has actually been violated. The opposite-signal SellSignal() is the symmetric mirror. OnTimer() fires every 30 seconds and dispatches CheckForTrail(), CheckForEquity(), and CheckForGrid() when their toggles are on. The default config (Grid = false, IgnoreSL = true, IgnoreTP = true) is a single-shot, trailing-only, no-protection setup on AUDUSD M5.

Entry Signal

Long entries fire on the close of the bar where AOS_Bull crosses above AOS_Signal (Bull[2] <= Signal[2] AND Bull[1] > Signal[1]), provided the engine also finds a recent AOS swing low and a bar whose high sat below the running daily low while AOS_Bull was still below AOS_Bear. Short entries are the mirror on Bear crossing above Signal with a daily-high break and AOS_Bull above AOS_Bear.

Exit Signal

There is no per-trade SL or TP attached by default. The only mechanical exit is the trailing stop, which ratchets behind each position via ea.CheckForTrail() in OnTimer() every 30 seconds. The grid layer, when enabled, can also close the basket when its own tighter trailing (GridTrailingStopLevel = 20%) is satisfied, and the global equity stop flattens everything if EquityDrawdownLimit is set.

Stop Loss

The framework computes a swing-based SL via BuySL(SL_SWING, 7, 60) and passes it to the order, but IgnoreSL = true is the default, so the framework does not attach the SL to the position. The lot size is still scaled to that stop distance, so a 0.5% Risk per trade assumes the un-attached swing SL distance. Setting IgnoreSL = false would engage the swing stop.

Take Profit

TP is computed as entry + 1.5 * |entry - SL| (TPCoef = 1.5), but IgnoreTP = true is the default, so the framework does not attach the TP to the order. Winners run until the trailing stop closes them. With the grid on, basket-level exits are governed by GridTrailingStopLevel = 20%, which is tighter than the per-trade trail.

Best For

AUDUSD M5 traders running the EA on a low-spread ECN with $100 minimum deposit and high risk tolerance. The contrarian entry style works best in range-bound sessions where false breakouts of the daily low get faded, particularly during the London/New York overlap when AUDUSD volume is highest. Very High risk profile — the trailing-only exit can produce deep drawdowns on runaway moves.

Strategy Logic

Pipsgrowth EX03025 Grid — Strategy Logic Analysis (from .mq5 source)

Family: Grid Magic: 22203025 Version: 2.00

BRIEF: Daily High/Low breakout with Andean Oscillator confirmation for scalping. Buy when AOS Bull crosses above Signal and price breaks below Daily Low; Sell when AOS Bear crosses above Signal and price breaks above Daily High. Grid recovery with trailing. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester

INDICATOR STACK:

  • Standard MT5 indicators

KEY FUNCTIONS:

  • ComputeAndeanOscillator()
  • ComputeDailyHighLow()
  • BuySignal()
  • SellSignal()
  • OnTimer()

INTERNAL CONSTANTS (0 total):

INPUT PARAMETERS (34 total across 7 groups):

  • [=== Indicator Parameters ===] AosPeriod = 50 // AOS Period
  • [=== Indicator Parameters ===] AosSignalPeriod = 9 // AOS Signal Period
  • [=== General ===] TPCoef = 1.5 // TP Coefficient
  • [=== General ===] SLType = SL_SWING // SL Type
  • [=== General ===] SLLookback = 7 // SL Look Back
  • [=== General ===] SLDev = 60 // SL Deviation (Points)
  • [=== General ===] AosNCheck = 300 // AOS Max Candles
  • [=== General ===] DhlNCheck = 50 // DHL Max Candles
  • [=== General ===] Reverse = false // Reverse Signal
  • [=== Risk Management ===] Risk = 0.5 // Risk
  • [=== Risk Management ===] RiskMode = RISK_DEFAULT // Risk Mode
  • [=== Risk Management ===] IgnoreSL = true // Ignore SL
  • [=== Risk Management ===] IgnoreTP = true // Ignore TP
  • [=== Risk Management ===] Trail = true // Trailing Stop
  • [=== Risk Management ===] TrailingStopLevel = 50 // Trailing Stop Level (%) (0: Disable)
  • [=== Risk Management ===] EquityDrawdownLimit = 0 // Equity Drawdown Limit (%) (0: Disable)
  • [=== Strategy: Grid ===] Grid = false // Grid Enable
  • [=== Strategy: Grid ===] GridVolMult = 1.1 // Grid Volume Multiplier
  • [=== Strategy: Grid ===] GridTrailingStopLevel = 20 // Grid Trailing Stop Level (%) (0: Disable)
  • [=== Strategy: Grid ===] GridMaxLvl = 50 // Grid Max Levels
  • [=== News ===] News = false // News Enable
  • [=== News ===] NewsImportance = NEWS_IMPORTANCE_MEDIUM // News Importance
  • [=== News ===] NewsMinsBefore = 60 // News Minutes Before
  • [=== News ===] NewsMinsAfter = 60 // News Minutes After
  • [=== News ===] NewsStartYear = 0 // News Start Year to Fetch for Backtesting (0: Disable)
  • [=== Open Position Limit ===] OpenNewPos = true // Allow Opening New Position
  • [=== Open Position Limit ===] MultipleOpenPos = false // Allow Having Multiple Open Positions
  • [=== Open Position Limit ===] MarginLimit = 300 // Margin Limit (%) (0: Disable)
  • [=== Open Position Limit ===] SpreadLimit = -1 // Spread Limit (Points) (-1: Disable)
  • [=== Identity ===] Slippage = 30 // Slippage (Points)
  • [=== Identity ===] TimerInterval = 30 // Timer Interval (Seconds)
  • [=== Identity ===] MagicNumber = 22203025 // Magic Number
  • [=== Identity ===] InpTradeComment = "Psgrowth.com Expert_03025" // Trade Comment
  • [=== Identity ===] Filling = FILLING_DEFAULT // Order Filling
Pseudocode
// Pipsgrowth EX03025 Grid — Execution Flow (from source analysis)
// Family: Grid
// Daily High/Low breakout with Andean Oscillator confirmation for scalping. Buy when AOS Bull crosses above Signal and price breaks below Daily Low; Sell when AOS Bear crosses above Signal and price breaks above Daily High. Grid recovery with trailing. 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:
AUDUSD
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 a chart — H1 or H4 is recommended for grid EAs
  7. 7Set grid step (pips), maximum orders, and lot size in the EA dialog
  8. 8Enable Allow Algo Trading and click OK

EA Parameters

ParameterDefaultDescription
AosPeriod50AOS Period
AosSignalPeriod9AOS Signal Period
TPCoef1.5TP Coefficient
SLTypeSL_SWINGSL Type
SLLookback7SL Look Back
SLDev60SL Deviation (Points)
AosNCheck300AOS Max Candles
DhlNCheck50DHL Max Candles
ReversefalseReverse Signal
Risk0.5Risk
RiskModeRISK_DEFAULTRisk Mode
IgnoreSLtrueIgnore SL
IgnoreTPtrueIgnore TP
TrailtrueTrailing Stop
TrailingStopLevel50Trailing Stop Level (%) (0: Disable)
EquityDrawdownLimit0Equity Drawdown Limit (%) (0: Disable)
GridfalseGrid Enable
GridVolMult1.1Grid Volume Multiplier
GridTrailingStopLevel20Grid Trailing Stop Level (%) (0: Disable)
GridMaxLvl50Grid Max Levels
NewsfalseNews Enable
NewsImportanceNEWS_IMPORTANCE_MEDIUMNews Importance
NewsMinsBefore60News Minutes Before
NewsMinsAfter60News Minutes After
NewsStartYear0News Start Year to Fetch for Backtesting (0: Disable)
OpenNewPostrueAllow Opening New Position
MultipleOpenPosfalseAllow Having Multiple Open Positions
MarginLimit300Margin Limit (%) (0: Disable)
SpreadLimit-1Spread Limit (Points) (-1: Disable)
Slippage30Slippage (Points)
TimerInterval30Timer Interval (Seconds)
MagicNumber22203025Magic Number
InpTradeComment"Psgrowth.com Expert_03025"Trade Comment
FillingFILLING_DEFAULTOrder Filling
Source Code (.mq5)Open Source
Pipsgrowth_com_EX03025.mq5
#property copyright "Pipsgrowth.com"
#property link      "https://pipsgrowth.com"
#property version   "2.00"
#property strict
#property description "Pipsgrowth.com EX03025 DHLAOS — Daily High/Low + Andean Oscillator scalping with grid, full 12-layer stack."

#include <EAUtils.mqh>

input group "=== Indicator Parameters ==="
input int AosPeriod = 50;          // AOS Period
input int AosSignalPeriod = 9;     // AOS Signal Period

input group "=== General ==="
input double TPCoef = 1.5;         // TP Coefficient
input ENUM_SL SLType = SL_SWING;   // SL Type
input int SLLookback = 7;          // SL Look Back
input int SLDev = 60;              // SL Deviation (Points)
input int AosNCheck = 300;         // AOS Max Candles
input int DhlNCheck = 50;          // DHL Max Candles
input bool Reverse = false;        // Reverse Signal

input group "=== Risk Management ==="
input double Risk = 0.5;           // Risk
input ENUM_RISK RiskMode = RISK_DEFAULT;  // Risk Mode
input bool IgnoreSL = true;        // Ignore SL
input bool IgnoreTP = true;        // Ignore TP
input bool Trail = true;           // Trailing Stop
input double TrailingStopLevel = 50;  // Trailing Stop Level (%) (0: Disable)
input double EquityDrawdownLimit = 0; // Equity Drawdown Limit (%) (0: Disable)

input group "=== Strategy: Grid ==="
input bool Grid = false;           // Grid Enable
input double GridVolMult = 1.1;    // Grid Volume Multiplier
input double GridTrailingStopLevel = 20; // Grid Trailing Stop Level (%) (0: Disable)
input int GridMaxLvl = 50;         // Grid Max Levels

input group "=== News ==="
input bool News = false;           // News Enable
input ENUM_NEWS_IMPORTANCE NewsImportance = NEWS_IMPORTANCE_MEDIUM; // News Importance
input int NewsMinsBefore = 60;     // News Minutes Before
input int NewsMinsAfter = 60;      // News Minutes After
input int NewsStartYear = 0;       // News Start Year to Fetch for Backtesting (0: Disable)

input group "=== Open Position Limit ==="
input bool OpenNewPos = true;      // Allow Opening New Position
input bool MultipleOpenPos = false; // Allow Having Multiple Open Positions
input double MarginLimit = 300;    // Margin Limit (%) (0: Disable)
input int SpreadLimit = -1;        // Spread Limit (Points) (-1: Disable)

input group "=== Identity ==="
input int Slippage = 30;           // Slippage (Points)
input int TimerInterval = 30;      // Timer Interval (Seconds)
input ulong MagicNumber = 22203025; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_03025"; // Trade Comment
input ENUM_FILLING Filling = FILLING_DEFAULT; // Order Filling

GerEA ea;
datetime lastCandle;
datetime tc;
int BuffSize;

Full source code available on download

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

Tags:ex03025gridpipsgrowthfreemt5audusd

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_EX03025.mq5
File Size12.7 KB
Versionv2.00
PlatformMetaTrader 5
File Type.mq5 Source
StrategyGrid
Risk LevelVery High Risk
Timeframes
M5
Currency Pairs
AUDUSD
Min. Deposit$100