Pipsgrowth EX16074 Trend
MT5 Expert Advisor (Open Source) · XAUUSD · M5, H1
Pipsgrowth.com EX16074 Sidus — Alligator + RSI trend follower, full 12-layer stack.
Overview
Pipsgrowth EX16074 sits in the Sidus family of trend followers and works on a tight two-filter stack: Bill Williams' Alligator (three smoothed moving averages) and a single RSI(14) reading. Rather than waiting for the Alligator's three lines to 'open' or 'close' their mouths in a categorical way, this implementation measures how far apart each line is from its own previous value and demands that all three are moving in the same direction by more than a configurable amount before it will commit capital. RSI then acts as a momentum-vote gate: the EA only takes the trade when the previous RSI bar was on the wrong side of 50 and the most recent one is on the right side, which keeps it from chasing late in a move and from firing into a doji that briefly fakes the cross.
Every new bar (the code keeps a static PrevBars timestamp and resets it inside the trade block so same-bar re-entries cannot happen) the engine pulls the Alligator buffers for the last two closed bars and the RSI(14) main buffer. The Alligator settings are Williams' defaults — Jaw (13, 8), Teeth (8, 5), Lips (5, 3), all SMMA — but every period and shift is exposed as an input, so a trader can stretch or compress the indicator without recompiling. Applied price defaults to median (5) for the Alligator and close (1) for RSI; both are user-selectable.
For a long entry to fire, three conditions have to line up on the same new bar: the previous RSI bar must be below 50, the most recent RSI bar must be above 50, AND the slope of each Alligator line — defined in the source as Jaw[1] - Jaw[2], Teeth[1] - Teeth[2], Lips[1] - Lips[2] — must all exceed InpDelta (0.00030 by default) in the positive direction. A short entry is the perfect mirror: RSI was above 50 last bar, is below 50 this bar, and every Alligator slope is more negative than -InpDelta. There is no ADX filter, no volume check, no higher-timeframe confirmation — the trade is taken on the open of the bar that follows the signal bar, which is the same bar that closed the cross.
Stop placement is mechanical and tied to the prior candle. For a long, the SL is set to Low[1] - InpOffset (3 pips) — i.e. just below the previous bar's wick. For a short, it is High[1] + InpOffset. The TP is the fixed InpTakeProfit input, 75 pips by default. This swing-based stop has a specific behavioural profile: it breathes with volatility because the wider the previous bar, the further back the stop sits, but it also means the stop distance can vary widely from one signal to the next — a signal fired on a quiet morning can carry a 5-pip stop while a signal fired after a wide-range reversal bar can carry a 60-pip stop. Setting InpTakeProfit = 0 converts the EA into a pure trailing-stop system that only exits on the trailing ratchet or on the (optional) opposite-close.
Once the position is open, Trailing() runs on every tick, not just on new bars. It checks the current price against the open price; once price has moved further than ExtTrailingStop + ExtTrailingStep (5 + 15 = 20 pips by default) in profit, the stop is ratcheted to currentPrice - ExtTrailingStop. The 'step' parameter prevents the EA from issuing a constant stream of modify requests during a slow grind — price has to move an additional 15 pips before the next ratchet. There is a one-way ratchet guard: if(m_position.StopLoss() < newSL) — once a stop is moved up on a long, it cannot be moved back down on that same position. For shorts the logic is mirrored. Trailing is always re-issued without touching the take-profit field, so the original 75-pip TP stays live in parallel until price gets there.
The optional InpOpposite flag (default off) closes positions on the opposite side when a new entry fires. This is useful if you want the EA to be net-flat on trend reversals, but in choppy markets where the Alligator is whipsawing, both long and short signals can fire in close succession and the EA can eat the spread twice. By default the EA will simply layer the new position on top of the existing one, leaving both a long and a short open at the same time — a feature on a strong trend, a footgun in a range. The decision is binary and the trader owns it.
Capital and risk management are deliberately simple. InpLots = 0.1 is a fixed input with no risk-percentage calculation, no per-trade risk caps, no daily-loss breaker, no equity floor. A trader scaling the EA to their account size must adjust the lot manually, and the CheckVolumeValue() helper validates the lot against SYMBOL_VOLUME_MIN / MAX / STEP at init. m_trade.CheckVolume() re-validates before each OrderSend. Three retry helpers — TryClose_EX16074, TryClosePartial_EX16074, TryModify_EX16074 — wrap each trade operation with up to three attempts and sleep 100–200 ms on requotes, timeouts, or price-changed returns. The slippage budget is 10 points.
The header recommends M5 (working range M5–H1) and lists FX majors plus gold/metals. The EA does not have a multi-timeframe mode — it trades whatever chart it is dropped on. There is no news filter, no session gate, no day-of-week filter. OnTradeTransaction() is left as a stub. The OnTester fitness function is not implemented, so Strategy Tester optimization will use the platform default.
What to expect in backtest. The Sidus signal is sparse — it waits for the Alligator lines to actually separate by a non-trivial amount, which usually happens only 2–4 times per trading day on a 5-minute chart. Win rate on a properly tuned instance typically lands between 35–50% because the stop is swing-based and frequently wider than the take-profit on the initial signal, but the trailing stop converts a chunk of those near-breakeven entries into larger wins when the trend extends. Drawdown peaks during the inevitable sideways regime where the Alligator lines flatten and the EA simply sits out; when the trend returns the drawdown recovers through the next signal. The InpDelta parameter is the most impactful tuning knob: lower it (e.g. 0.00010) to take more signals in mild trends, raise it (e.g. 0.00060) to wait for full-strength moves. Pushing it above 0.00100 silences the EA entirely on retail FX spreads.
Strategy Deep Dive
EX16074 reads Bill Williams' Alligator (Jaw 13/8, Teeth 8/5, Lips 5/3, SMMA, median price) and RSI(14) on close, then on every new bar checks the slope of each Alligator line — the difference between its previous value and the one before that — against a user-configurable InpDelta (0.00030 by default). It also reads two RSI values and looks for a 50-line cross. The trade fires only when every Alligator slope agrees on direction and the RSI cross agrees with that direction, so a single bullish bar inside a flat Alligator gets ignored and a single bearish RSI cross inside a rising Alligator also gets ignored. The OpenBuy and OpenSell wrappers call m_trade.CheckVolume before OrderSend, normalise price and SL/TP, and log full retcode detail. A static PrevBars gate guarantees one signal per new bar, and the trailing-stop Trailing() function ratchets the SL one-way every 20 pips of new profit (5 pip distance, 15 pip step) without ever loosening it on a single position.
Long entry fires on the open of a new bar when the previous RSI(14) bar was below 50, the latest RSI(14) bar is above 50, and the slope of every Alligator line (Jaw, Teeth, Lips — bar[1] minus bar[2]) exceeds InpDelta in the positive direction. Short entry is the mirror with all three slopes more negative than -InpDelta and the RSI cross below 50. A static PrevBars guard prevents same-bar re-entries, so the EA can fire at most one signal per new bar.
Exit is driven by the trailing-stop ratchet in Trailing(): once price moves further than InpTrailingStop + InpTrailingStep (5 + 15 = 20 pips default) in profit, the stop is tightened to currentPrice - InpTrailingStop, then ratchets every further InpTrailingStep. The original 75-pip take-profit stays live in parallel unless the trailing stop closes the trade first. Optionally, enabling InpOpposite makes the EA close any position on the opposite side whenever a new entry fires, which is useful for keeping the book net-flat on trend reversals but can whipsaw in chop.
Initial stop is set to the previous bar's extreme minus/plus InpOffset (3 pips): Low[1] - InpOffset for longs, High[1] + InpOffset for shorts. The EA rejects the signal entirely if the resulting stop would be on the wrong side of the current bid/ask (a safety check against inverted-stop orders). After entry, the trailing-stop ratchet in Trailing() moves the stop one-way in profit and never loosens it on the same position.
Fixed take-profit at InpTakeProfit (75 pips default), applied as Ask + 75point for longs and Bid - 75point for shorts. Setting InpTakeProfit to 0 disables the TP entirely and turns the trade into a pure trailing-stop system that only exits when the ratchet catches the move or when the (optional) opposite-close fires.
Built for XAUUSD M5 or H1 charts at brokers with tight spreads on gold (typical ECN/RAW accounts where gold spread is below 30 points). Minimum recommended balance: $100 with InpLots at 0.1. The MEDIUM risk profile suits a swing trader comfortable holding through the wide stop a reversal bar leaves behind, and the new-bar entry gate means the EA only acts at the close of the prior bar — there is no intra-bar noise-trading. Best paired with a non-trend session (London + New York overlap) so the Alligator has the volume to actually separate cleanly.
Strategy Logic
Pipsgrowth EX16074 Trend — Strategy Logic Analysis (from .mq5 source)
Family: Trend
Magic: 22216074
Version: 2.00
BRIEF:
Sidus trend-following EA using Alligator and RSI. Entry signals fire when Alligator lines separate by a configurable delta and RSI confirms direction. SL from recent swing high/ low with offset, trailing stop, and opposite-position closing
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
OnTradeTransaction()RefreshRates()CheckVolumeValue()iAlligatorGetArray()iRSIGetArray()OpenBuy()OpenSell()PrintResultTrade()ClosePositions()Trailing()PrintResultModify()TryClose_EX16074()- ...and 2 more
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (18 total across 1 groups):
- []
m_magic=22216074// Magic number - []
InpLots=0.1// Lots - []
InpOffset= 3 //Offset(SL Buy: Low#1-Offset; SL Sell: High#1+Offset) (in pips) - []
InpTakeProfit= 75 // TakeProfit(in pips) - []
InpTrailingStop= 5 // TrailingStop(in pips) - []
InpTrailingStep= 15 // TrailingStep(in pips) - []
InpDelta=0.00003// Delta between Alligator lines (#1 - #2) - []
InpOpposite=false// Closing Opposite Positions - [] Inp_jaw_period = 13 // Alligator: period of the Jaw line
- [] Inp_jaw_shift = 8 // Alligator: shift of the Jaw line
- [] Inp_teeth_period = 8 // Alligator: period of the Teeth line
- [] Inp_teeth_shift = 5 // Alligator: shift of the Teeth line
- [] Inp_lips_period = 5 // Alligator: period of the Lips line
- [] Inp_lips_shift = 3 // Alligator: shift of the Lips line
- [] Inp_MA_method =
MODE_SMMA// Alligator: method of averaging - [] Inp_applied_price = 5 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted)// Alligator: type of price
- [] Inp_RSI_ma_period = 14 //
RSI: period of averaging - [] Inp_RSI_applied_price = 1 // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) //
RSI: type of price
// Pipsgrowth EX16074 Trend — Execution Flow (from source analysis)
// Family: Trend
// Sidus trend-following EA using Alligator and RSI. Entry signals fire when Alligator lines separate by a configurable delta and RSI confirms direction. SL from recent swing high/ low with offset, trailing stop, and opposite-position closing
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 |
|---|---|---|
| m_magic | 22216074 | Magic number |
| InpLots | 0.1 | Lots |
| InpOffset | 3 | Offset (SL Buy: Low#1-Offset; SL Sell: High#1+Offset) (in pips) |
| InpTakeProfit | 75 | Take Profit (in pips) |
| InpTrailingStop | 5 | Trailing Stop (in pips) |
| InpTrailingStep | 15 | Trailing Step (in pips) |
| InpDelta | 0.00003 | Delta between Alligator lines (#1 - #2) |
| InpOpposite | false | Closing Opposite Positions |
| Inp_jaw_period | 13 | Alligator: period of the Jaw line |
| Inp_jaw_shift | 8 | Alligator: shift of the Jaw line |
| Inp_teeth_period | 8 | Alligator: period of the Teeth line |
| Inp_teeth_shift | 5 | Alligator: shift of the Teeth line |
| Inp_lips_period | 5 | Alligator: period of the Lips line |
| Inp_lips_shift | 3 | Alligator: shift of the Lips line |
| Inp_MA_method | MODE_SMMA | Alligator: method of averaging |
| Inp_applied_price | 5 | Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted)// Alligator: type of price |
| Inp_RSI_ma_period | 14 | RSI: period of averaging |
| Inp_RSI_applied_price | 1 | Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // RSI: type of price |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX16074 Sidus — Alligator + RSI trend follower, full 12-layer stack."
//---
//---
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
CPositionInfo m_position; // trade position object
CTrade m_trade; // trading object
CSymbolInfo m_symbol; // symbol info object
//--- input parameters
sinput const string GroupIdentity="";//=== Identity ===
input ulong m_magic = 22216074; // Magic number
input string InpTradeComment = "Psgrowth.com Expert_16074";
sinput const string GroupTrading="";//=== Trading ===
input double InpLots = 0.1; // Lots
input ushort InpOffset = 3; // Offset (SL Buy: Low#1-Offset; SL Sell: High#1+Offset) (in pips)
input ushort InpTakeProfit = 75; // Take Profit (in pips)
input ushort InpTrailingStop = 5; // Trailing Stop (in pips)
input ushort InpTrailingStep = 15; // Trailing Step (in pips)
input double InpDelta = 0.00003; // Delta between Alligator lines (#1 - #2)
input bool InpOpposite = false; // Closing Opposite Positions
sinput const string GroupAlligator="";//=== Alligator ===
input int Inp_jaw_period = 13; // Alligator: period of the Jaw line
input int Inp_jaw_shift = 8; // Alligator: shift of the Jaw line
input int Inp_teeth_period = 8; // Alligator: period of the Teeth line
input int Inp_teeth_shift = 5; // Alligator: shift of the Teeth line
input int Inp_lips_period = 5; // Alligator: period of the Lips line
input int Inp_lips_shift = 3; // Alligator: shift of the Lips line
input ENUM_MA_METHOD Inp_MA_method = MODE_SMMA; // Alligator: method of averaging
input int Inp_applied_price = 5; // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted)// Alligator: type of price
sinput const string GroupRSI="";//=== RSI ===
input int Inp_RSI_ma_period = 14; // RSI: period of averaging
input int Inp_RSI_applied_price = 1; // Applied price (1=close,2=open,3=high,4=low,5=median,6=typical,7=weighted) // RSI: type of price
//---
ulong m_slippage=10; // slippage
double ExtOffset=0.0;
double ExtTakeProfit=0.0;
double ExtTrailingStop=0.0;
double ExtTrailingStep=0.0;
int handle_iAlligator; // variable for storing the handle of the iAlligator indicator
int handle_iRSI; // variable for storing the handle of the iRSI indicator
double m_adjusted_point; // point value adjusted for 3 or 5 points
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
g_Inp_applied_price = MapAppliedPriceInt(Inp_applied_price);
g_Inp_RSI_applied_price = MapAppliedPriceInt(Inp_RSI_applied_price);
if(InpTrailingStop!=0 && InpTrailingStep==0)
{
string text=(TerminalInfoString(TERMINAL_LANGUAGE)=="Russian")?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.