Pipsgrowth EX16088 Trend
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX16088 BullishBearish_MeetingLines_MFI - Meeting Lines pattern + MFI confirm, full 12-layer stack.
Overview
Pipsgrowth EX16088 is a Japanese candlestick pattern EA that trades Meeting Lines reversals on the M5, M15, and H1 charts of XAUUSD (and any other symbol the EA is attached to, since it uses _Symbol and _Period everywhere). The pattern itself is a two-candle indecision setup: a long bullish candle followed by a long bearish candle (or vice versa) whose closes sit within one-tenth of the average candle body. The EA fires a sell signal when bar 2 is bullish and bar 1 is bearish with that close-equality, and a buy signal on the mirror. Because the second candle 'meets' the first one's close at almost the same level, the pattern is interpreted as a failed continuation attempt — the market tried to extend in one direction and was rejected by the opposing force.
Each signal must be confirmed by the Money Flow Index (MFI) before any order is sent. The confirmation module reads MFI(37) on volume type VOLUME_TICK, and applies asymmetric thresholds: a buy setup needs MFI below 40 (a washout from oversold territory), while a sell setup needs MFI above 60 (a push from overbought). Without that confirmation, the signal is dropped — CheckConfirmation() returns success but flips ExtConfirmed to false, which propagates back to ExtSignalOpen = SIGNAL_NOT inside CheckState(). The MFI(37) period matches the indicator period used in adjacent EAs in this family, but the volume-weighted logic means MFI reacts differently during low-liquidity sessions because tick volume on metals is not the same as real exchange volume; on quiet XAUUSD overnight bars the MFI can stay pinned near the middle of its range.
The EA enters at the open of the bar immediately following confirmation. Risk management is fixed: every trade uses InpLot=0.1 (no risk-percent, no balance-proportional sizing), a 200-point stop loss, and a 200-point take profit, giving a 1:1 reward-to-risk ratio. Lot is snapped to the broker's volume step inside the PositionOpen() call via m_trade.CheckVolume implicit handling, and InpSlippage=10 is the maximum tolerated price deviation set on the CTrade object. The protective levels are validated against the live spread inside PositionOpen(): if the spread is wider than the configured SL distance, the EA uses the spread itself as the floor (stoploss = price - spread for buys), and the same fallback applies to the TP side. That is a deliberate safety: in fast markets the original 200 points could be tighter than the spread, so the EA widens the stop to the actual spread to keep the order valid.
Time exit is wired through CloseByTime() and PositionExpiredByTimeExist(). After InpDuration=10 bars have elapsed since the entry, the position is force-closed regardless of profit or loss. The check uses BarsHold(open_time), which counts the bars between the entry timestamp and TimeCurrent() via CopyRates — so on M5 a 10-bar exit fires after roughly 50 minutes, on M15 after about 2.5 hours, on H1 after 10 hours. There is no separate breakeven, no trailing stop, and no partial close. The position either hits the 200-point TP, the 200-point SL, the time-based forced close, or a reverse signal — those are the four exit paths and nothing else.
Reverse-signal exits come from CheckCloseSignal() and run on MFI(1) and MFI(2) level crosses. A long is closed when MFI(1) drops below 70 while MFI(2) was above 70 (a fall from overbought), or when MFI(1) drops below 30 while MFI(2) was above 30 (a fall from the upper neutral zone) — both treated as momentum-fade exits. A short is closed on the mirror. This logic only runs on bars where there is no entry signal, so a fresh Meeting Lines setup always takes priority over a close-by-momentum on the same bar.
The retry layer is built around three helpers — TryClose_EX16088, TryClosePartial_EX16088, and TryModify_EX16088 — each running up to three attempts on TRADE_RETCODE_REQUOTE, TRADE_RETCODE_TIMEOUT, TRADE_RETCODE_PRICE_OFF, or TRADE_RETCODE_PRICE_CHANGED return codes with a 100–200ms Sleep between attempts. Only TryClose_EX16088 is actually wired into the live runtime: CloseBySignal and CloseByTime both call it. The partial-close and modify helpers are compiled into the binary but never invoked from OnTick — they are dead code that ships with the file. If you later want trailing stops or split exits, the helpers are ready, you just have to add the calls into the right phase of the tick loop.
Position filtering in PositionExist() and the close functions is strict: only the symbol the EA is attached to and the magic number InpMagicNumber=22216088 are touched. Running multiple EAs on the same XAUUSD chart is safe as long as each has a different magic; the EA will not interfere with positions opened by other experts or by manual trades. There is no built-in session filter, no news filter, no daily P&L circuit breaker, no equity floor, and no OnTester optimization target, despite the header's mention of a 12-layer architecture.
The session profile depends entirely on the timeframe the EA is dropped onto. On M5 with the default 10-bar forced close, the EA cycles positions through roughly 50-minute round-trips, which means most of its activity concentrates during the London morning and the overlap into the New York morning. The pattern itself — two strong opposing candles with nearly equal closes — is more common in active markets, so quieter Asian sessions on M5 can produce fewer but occasionally larger signals as one big stop-run forms the first candle. For backtesting: expect a hit rate near 50% given the 1:1 RR (slightly above 50% is required for profitability after spread and slippage). The MFI asymmetry — buy below 40, sell above 60 — means the EA is naturally more selective on the buy side, since MFI under 40 is rarer on XAUUSD than MFI over 60.
Strategy Deep Dive
On every new bar, the EA scans the previous two completed candles for the Meeting Lines geometry, then samples MFI(37) on tick volume to gate the signal. Buy and sell thresholds are asymmetric (40 / 60), so the EA is more selective on the buy side. PositionOpen() applies a 200-point stop and target with a built-in spread-floor safety: if the spread is wider than the protective distance, the EA widens the SL or TP to the spread itself. Exits run on four paths — 200-point TP, 200-point SL, ten-bar forced close, and MFI momentum cross. TryClose_EX16088 wraps the close with three retries on requote, timeout, and price-change return codes; TryClosePartial_EX16088 and TryModify_EX16088 are compiled but not wired into the live runtime.
Triggers a market order when a two-candle Meeting Lines pattern forms — bar 2 is a long-body candle, bar 1 is a long-body candle in the opposite direction, and the two closes sit within 0.1× the 12-bar average body — provided the MFI(37) confirms: MFI below 40 for buys, MFI above 60 for sells. Entry fires on the open of the bar following confirmation with a fixed 0.1 lot, no risk-percent scaling, and 10-point slippage tolerance.
Closes on either the 200-point TP, the 200-point SL, the 10-bar time-based forced close, or a reverse MFI momentum signal — MFI(1) crossing below 70 from above, or below 30 from above, exits longs (and the mirror for shorts). Only one position is open per signal direction, and entry signals always preempt close-by-momentum checks on the same bar.
Fixed 200-point stop loss on every trade; if the live spread is wider than the 200-point distance, the EA widens the stop to match the spread so the order remains valid. No trailing, no breakeven, no per-trade adjustment after entry.
Fixed 200-point take profit (1:1 RR with the stop); if the live spread exceeds 200 points, the TP is widened to the spread for order validity. There is no scaling-out, no partial close, and no break-even ratchet.
Best for XAUUSD on M5–H1 with a minimum recommended balance of $100 (covers the 0.1 lot fixed sizing on metals). Because the EA reads MFI on tick volume, an ECN-style broker with reliable tick data is preferred; high-latency feeds can desync the MFI confirmation. The 1:1 RR plus ten-bar forced close profile suits traders who want short, frequent round-trips rather than swing holds, and the asymmetric MFI thresholds mean the EA is naturally less active on the buy side.
Strategy Logic
Pipsgrowth EX16088 Trend — Strategy Logic Analysis (from .mq5 source)
Family: Trend
Magic: 22216088
Version: 2.00
BRIEF:
MeetingLines pattern + MFI confirm, time exit 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CheckState()PositionOpen()CloseBySignal()CloseByTime()PositionExist()PositionExpiredByTimeExist()BarsHold()Open()Close()Low()High()MidPoint()- ...and 9 more
INTERNAL CONSTANTS (3 total):
SIGNAL_BUY= 1 // Buy signalSIGNAL_NOT= 0 // no trading signalCLOSE_LONG= 2 // signal to close Long
INPUT PARAMETERS (10 total across 4 groups):
- [=== Pattern Parameters ===]
InpAverBodyPeriod= 12 // period for calculating average candlestick size - [=== Pattern Parameters ===]
InpPeriodMFI= 37 //MFIperiod - [=== Pattern Parameters ===]
InpVolume=VOLUME_TICK// volume type - [=== Trade Parameters ===]
InpDuration= 10 // position holding time in bars - [=== Trade Parameters ===]
InpSL= 200 // Stop Loss in points - [=== Trade Parameters ===]
InpTP= 200 // Take Profit in points - [=== Trade Parameters ===]
InpSlippage= 10 // slippage in points - [=== Money Management ===]
InpLot=0.1// lot - [=== Identity ===]
InpMagicNumber=22216088// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_16088" // Trade comment
// Pipsgrowth EX16088 Trend — Execution Flow (from source analysis)
// Family: Trend
// MeetingLines pattern + MFI confirm, time exit 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 an H4 or Daily chart for best results
- 7Configure EMA periods, ADX threshold, and lot size in the dialog
- 8Enable Allow Algo Trading and click OK
EA Parameters
| Parameter | Default | Description |
|---|---|---|
| InpAverBodyPeriod | 12 | period for calculating average candlestick size |
| InpPeriodMFI | 37 | MFI period |
| InpVolume | VOLUME_TICK | volume type |
| InpDuration | 10 | position holding time in bars |
| InpSL | 200 | Stop Loss in points |
| InpTP | 200 | Take Profit in points |
| InpSlippage | 10 | slippage in points |
| InpLot | 0.1 | lot |
| InpMagicNumber | 22216088 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_16088" | Trade comment |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX16088 BullishBearish_MeetingLines_MFI - Meeting Lines pattern + MFI confirm, full 12-layer stack."
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#define SIGNAL_BUY 1 // Buy signal
#define SIGNAL_NOT 0 // no trading signal
#define SIGNAL_SELL -1 // Sell signal
#define CLOSE_LONG 2 // signal to close Long
#define CLOSE_SHORT -2 // signal to close Short
input group "=== Pattern Parameters ==="
input int InpAverBodyPeriod=12; // period for calculating average candlestick size
input int InpPeriodMFI =37; // MFI period
input ENUM_APPLIED_VOLUME InpVolume=VOLUME_TICK; // volume type
input group "=== Trade Parameters ==="
input uint InpDuration=10; // position holding time in bars
input uint InpSL =200; // Stop Loss in points
input uint InpTP =200; // Take Profit in points
input uint InpSlippage=10; // slippage in points
input group "=== Money Management ==="
input double InpLot=0.1; // lot
input group "=== Identity ==="
input long InpMagicNumber=22216088; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_16088"; // Trade comment
//--- global variables
int ExtAvgBodyPeriod; // average candlestick calculation period
int ExtSignalOpen =0; // Buy/Sell signal
int ExtSignalClose =0; // signal to close a position
string ExtPatternInfo =""; // current pattern information
string ExtDirection =""; // position opening direction
bool ExtPatternDetected=false; // pattern detected
bool ExtConfirmed =false; // pattern confirmed
bool ExtCloseByTime =true; // requires closing by time
bool ExtCheckPassed =true; // status checking error
//--- indicator handle
int ExtIndicatorHandle=INVALID_HANDLE;
//--- service objects
CTrade ExtTrade;
CSymbolInfo ExtSymbolInfo;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
Print("InpSL=", InpSL);
Print("InpTP=", InpTP);
//--- set parameters for trading operations
ExtTrade.SetDeviationInPoints(InpSlippage); // slippage
ExtTrade.SetExpertMagicNumber(InpMagicNumber); // Expert Advisor ID
ExtTrade.LogLevel(LOG_LEVEL_ERRORS); // logging level
ExtAvgBodyPeriod=InpAverBodyPeriod;
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 Trend Following strategy EAs from our library
Pipsgrowth EX16080 Trend
Pipsgrowth.com EX16080 EURUSDTrendFollower — triple-EMA H4 trend follower, full 12-layer stack.
Pipsgrowth EX16081 Trend
Pipsgrowth.com EX16081 GoldTrendEA — XAUUSD H4 EMA cross with Fib targets, full 12-layer stack.
Pipsgrowth EX16033 Trend
Pipsgrowth.com EX16033 EA_Price_Action — price-action grid scalper, full 12-layer stack.
Community
Educational purposes only. Do NOT use with real money. Test on demo accounts only.