Pipsgrowth EX18104 TrendFollow
MT5 Expert Advisor (Open Source) · AUDUSD · M15, H1
Pipsgrowth.com EX18104 SimpleRSIReversalAUDUSD — RSI reversal in Asian session with panel, full 12-layer stack.
Overview
Pipsgrowth EX18104 is a single-indicator mean-reversion EA designed to harvest short-term reversals out of deeply overstretched RSI conditions during the Asian session. The logic is intentionally lopsided: it treats exhaustion of the bearish side as a much more extreme event than exhaustion of the bullish side, which is encoded in the asymmetric OverboughtLevel / OversoldLevel thresholds. The buy path activates when the 28-period RSI on a 15-minute bar drops through 8 — a level so deep that on AUDUSD M15 it fires only a handful of times per month, on the kind of capitulation candle that often marks a local low. The sell path, by contrast, activates the moment RSI climbs back above 60, a moderate overbought reading that fires much more frequently and is best understood as "fade strength in a still-rangey tape" rather than "fade a runaway trend." This split is the EA's signature design choice and the reason it can run on a single timeframe / single indicator without becoming a noise magnet.
The Asian-session gate is the second pillar. All order logic is wrapped in IsAsianSession(), which uses TimeToStruct on the server clock and admits only the hours 00:00–07:59 UTC. Outside that window the EA simply returns. If CloseOutsideSession is flipped on, the first tick of every non-Asian hour triggers CloseAllTrades() to flatten — useful for traders who want zero exposure during London and New York. With the default false setting, open positions are allowed to drift through the rest of the day and rely on the EA's other exit paths. The session flag is also surfaced on the on-chart info panel as the third row, so the user can confirm at a glance which window the EA considers active.
Indicator handling is minimal. OnInit calls iRSI(_Symbol, PERIOD_M15, RSIPeriod, PRICE_CLOSE) and copies three values into a reverse-ordered array; if the buffer is not ready after ten 100 ms retries it falls back to 50.0 / 50.0 / 50.0 and proceeds. The bar timeframe is hardcoded — the user can change RSIPeriod (default 28) but cannot change the chart timeframe that feeds the buffer. On every tick where the session gate passes and the spread is below the configured cap, OnTick refills rsiCurrent, rsiPrevious, and rsiPrevious2, then calls CheckRSICrossover() to set three booleans: rsiCrossedOversold, rsiCrossedOverbought, rsiCrossedExitLevel. Crossover here means a one-bar transition: prior value on one side of the threshold, current value on the other side, with no smoothing or averaging applied.
Entry logic is in the !hasOpenPosition block at the bottom of OnTick. The buy branch fires when rsiCrossedOversold is true — meaning RSI has just printed at or below 8 after being above 8 the bar before — and the ask is inside the MaxSpread cap. trade.Buy(MaxLotSize, _Symbol, currentAsk, sl, tp, InpTradeComment) is called with 3-point deviation and ORDER_FILLING_IOC. With the defaults UseStopLoss = false and UseTakeProfit = false, the SL/TP parameters passed to CTrade evaluate to 0/0, so the trade is opened as a pure mean-reversion position with no protective bracket. The sell branch mirrors that on the overbought cross above 60, opening at the bid with the same filling and slippage rules. The MaxLotSize = 0.1 input is a hard cap rather than a risk-based sizing — there is no balance-relative calculation, no percentage-of-equity input, and no SL-distance-based scaling.
Exits are layered. The primary path is the RSI exit: with UseRSIExit = true and RSIExitLevel = 55, a long position is closed the moment rsiCurrent crosses above 55 after being below, and a short position is closed the moment RSI crosses below 55 after being above. The 55 level is intentionally slightly bullish — it requires a long to actually climb back into the upper half of the RSI range before the EA is willing to take profit, while a short can exit as soon as RSI weakens to 55, making the long exit structurally more patient than the short exit. The secondary path is the time stop: MaxDuration = 270 hours (about 11.25 days) — if the position is still open past that window, CloseAllTrades("Timeout") is called from the open-position block. The third path is the optional session-end flatten, which only runs when CloseOutsideSession is true. There is no break-even move, no trailing stop, and no partial close in the live code path; the retry helpers TryClosePartial_EX18104 and TryModify_EX18104 are declared in the source but never wired in.
The on-chart panel (CreatePanel / UpdatePanel) is a 200×200 pixel OBJ_RECTANGLE_LABEL at PanelX = 10, PanelY = 20 with seven rows at 8-point font: RSI value, position status (Long / Short / None), spread in pips, current session name (Asian / London / New York / Other), the configured StopLossPips, the configured TakeProfitPips, and the most recent crossover label. Note that the panel always reports the configured SL and TP values rather than the values actually attached to the open position — with the defaults of UseStopLoss = false and UseTakeProfit = false, the panel will show "Stop Loss: 5 pips" and "Take Profit: 175 pips" even though the live position was opened with 0/0 brackets. This is a display artifact, not a trading error: the underlying position is unbracketed, but the panel shows what would be used if those booleans were enabled.
There are a few small things worth knowing before live use. The MaxSpread = 1000 input is documented as "in pips" but is actually compared in raw points — at 1000, on a 5-digit broker that is 10 pips, so it does not gate typical AUDUSD M15 conditions. The session gate runs on the broker server time, not the user's local time, and the Asian session is defined as 00:00–07:59 UTC; on brokers with GMT+2 or GMT+3 server time the window shifts accordingly. CloseAllTrades() has a leftover hasOurPositions flag with a hardcoded magic of 123456 inside an unused branch — harmless because the actual close loop iterates by _Symbol regardless, but worth noting if you read the source. The EA holds at most one position at a time and does not pyramid.
In a backtest, the realistic expectation is a low-frequency, high-precision profile: the OversoldLevel = 8 path is rare and should carry the bulk of the profit-per-trade, while the OverboughtLevel = 60 path is the workhorse and will produce a denser trade log. Curves tend to be choppy during trending sessions (when the buy path sits dormant and the sell path takes small losses against the trend) and clean during range-bound Asian hours. Risk is concentrated entirely in the time stop — without a hard stop-loss attached, a position that drifts against the EA's view is held until either the RSI exit fires or the 270-hour cap kicks in, so a single bad entry can give back a meaningful slice of monthly P&L. This is an EA for traders who want a session-defined, asymmetric reversion footprint and are comfortable letting the time stop do the work that a hard SL would do on a more conventional strategy.
Strategy Deep Dive
The EA pulls three RSI(28) values from a hardcoded M15 buffer on every tick, then runs CheckRSICrossover() to set three transition booleans — overbought, oversold, and exit-level. The OnTick entry branch is gated by IsAsianSession() (00:00–07:59 UTC) and a MaxSpread cap of 1000 raw points, after which rsiCrossedOversold fires a Buy of MaxLotSize = 0.1 with 0/0 brackets, and rsiCrossedOverbought fires a Sell with the same flat-bracket structure. Exits run in a fixed order from the open-position block: UseRSIExit closes on a cross of RSIExitLevel = 55 (asymmetric — long needs a cross above 55, short exits on a cross below), then a 270-hour time stop, then the optional session-end flatten. The on-chart panel is updated every tick with current RSI, position state, spread, session, and crossover label. The CTrade retry helpers TryClosePartial and TryModify are declared but never called, so partial closes and SL/TP modifications are not part of the live path.
Long entries fire on a single-bar RSI transition: when the 28-period RSI on the 15-minute bar drops to or below 8 after being above 8 on the previous bar, capturing deep-oversold capitulation. Short entries fire on the inverse transition: when RSI rises to or above 60 after being below, fading moderate overbought strength. Both paths are gated to the 00:00–07:59 UTC Asian session, and the open call uses CTrade with MaxLotSize = 0.1, 3-point deviation, and IOC filling — no SL/TP brackets are attached by default.
Exits are layered in priority: the primary path is an RSI cross of the configured exit level (55), closing longs when RSI rises back above 55 and shorts when RSI falls below 55. The secondary path is a time stop at MaxDuration = 270 hours (about 11.25 days), and the tertiary path is the optional session-end flatten when CloseOutsideSession is true. There is no break-even move, no trailing stop, and no partial close in the live code path.
No hard stop-loss is attached to open positions by default — UseStopLoss = false sends 0 as the SL parameter to trade.Buy / trade.Sell, so a position that drifts against the EA's view is held until either the RSI exit fires, the 270-hour time stop triggers, or the optional session-end flatten kicks in. The StopLossPips = 5 input is wired in but inert until the user flips the UseStopLoss boolean.
No hard take-profit is attached to open positions by default — UseTakeProfit = false sends 0 as the TP parameter to trade.Buy / trade.Sell, so the EA relies entirely on the RSI exit cross at 55 to close. The TakeProfitPips = 175 input is wired into the open call but inert until UseTakeProfit is flipped true; with it enabled, a 175-pip TP would be attached at entry, which dwarfs the typical 5-pip SL and would be an asymmetric R:R of 35:1 per trade.
Minimum recommended balance: $100 (the EA's hardcoded MaxLotSize = 0.1 keeps margin demand low on a 0.01-lot micro account and works on AUDUSD where a 0.1 lot is already a meaningful position). Best deployed on a low-spread ECN broker with AUDUSD M15 access — the MaxSpread = 1000 raw-point cap is generous enough to fire on any reasonable quote, and the Asian session gate (00:00–07:59 UTC) means most of the activity clusters into the pre-London Tokyo hours when AUDUSD is liquid but not yet in London-driven volatility. Suits MEDIUM-risk traders who want a session-defined, low-frequency reversion footprint on FX majors and are comfortable with unbracketed entries that rely on a 270-hour time stop and an RSI exit rather than hard protective stops.
Strategy Logic
Pipsgrowth EX18104 TrendFollow — Strategy Logic Analysis (from .mq5 source)
Family: TrendFollow
Magic: 22218104
Version: 2.00
BRIEF:
Simple RSI reversal EA targeting Asian session hours. Buys on oversold crossover and sells on overbought crossover with optional SL/TP and RSI-based exit. Includes on-chart info panel. 12 layers: REGIME, SIGNAL, ENTRY, CONFIRM, NO-TRADE, CAPITAL CAP, RISK, SIZING, MANAGE, EXIT, SCALING, OnTester
INDICATOR STACK:
- Standard
MT5indicators
KEY FUNCTIONS:
CreatePanel()CreateScoreLabel()UpdatePanel()IsAsianSession()GetCurrentSession()IsTradingAllowed()CheckRSICrossover()CloseAllTrades()TryClose_EX18104()TryClosePartial_EX18104()TryModify_EX18104()
INTERNAL CONSTANTS (0 total):
INPUT PARAMETERS (19 total across 3 groups):
- [=== Strategy ===] RSIPeriod = 28 //
RSIperiod - [=== Strategy ===]
OverboughtLevel= 60 // Overboughtlevel - [=== Strategy ===]
OversoldLevel= 8 // Oversoldlevel - [=== Strategy ===]
TakeProfitPips= 175 // Take profit in pips - [=== Strategy ===]
StopLossPips= 5 // Stop loss in pips - [=== Strategy ===]
MaxLotSize=0.1// Maximum lot size - [=== Strategy ===]
MaxSpread= 1000 // Maximum allowed spread in pips - [=== Strategy ===]
MaxDuration= 270 // Maximum trade duration in hours - [=== Strategy ===]
UseStopLoss=false// Use stop loss - [=== Strategy ===]
UseTakeProfit=false// Use take profit - [=== Strategy ===]
UseRSIExit=true// UseRSIfor exit - [=== Strategy ===] RSIExitLevel = 55 //
RSIlevelto exit (50 = neutral) - [=== Strategy ===]
CloseOutsideSession=false// Close trades outside Asian session - [=== Panel ===]
PanelBackground=clrBlack// Panel background color - [=== Panel ===]
PanelText=clrWhite// Panel text color - [=== Panel ===]
PanelX= 10 // Panel X position - [=== Panel ===]
PanelY= 20 // Panel Y position - [=== Identity ===]
InpMagicNumber=22218104// Magic Number - [=== Identity ===]
InpTradeComment= "Psgrowth.com Expert_18104" // TradeComment
// Pipsgrowth EX18104 TrendFollow — Execution Flow (from source analysis)
// Family: TrendFollow
// Simple RSI reversal EA targeting Asian session hours. Buys on oversold crossover and sells on overbought crossover with optional SL/TP and RSI-based exit. Includes on-chart info panel. 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 |
|---|---|---|
| RSIPeriod | 28 | RSI period |
| OverboughtLevel | 60 | Overbought level |
| OversoldLevel | 8 | Oversold level |
| TakeProfitPips | 175 | Take profit in pips |
| StopLossPips | 5 | Stop loss in pips |
| MaxLotSize | 0.1 | Maximum lot size |
| MaxSpread | 1000 | Maximum allowed spread in pips |
| MaxDuration | 270 | Maximum trade duration in hours |
| UseStopLoss | false | Use stop loss |
| UseTakeProfit | false | Use take profit |
| UseRSIExit | true | Use RSI for exit |
| RSIExitLevel | 55 | RSI level to exit (50 = neutral) |
| CloseOutsideSession | false | Close trades outside Asian session |
| PanelBackground | clrBlack | Panel background color |
| PanelText | clrWhite | Panel text color |
| PanelX | 10 | Panel X position |
| PanelY | 20 | Panel Y position |
| InpMagicNumber | 22218104 | Magic Number |
| InpTradeComment | "Psgrowth.com Expert_18104" | Trade Comment |
#property copyright "Pipsgrowth.com"
#property link "https://pipsgrowth.com"
#property version "2.00"
#property strict
#property description "Pipsgrowth.com EX18104 SimpleRSIReversalAUDUSD — RSI reversal in Asian session with panel, full 12-layer stack."
// Include trade class
#include <Trade\Trade.mqh>
// Input parameters
input group "=== Strategy ==="
input int RSIPeriod = 28; // RSI period
input double OverboughtLevel = 60; // Overbought level
input double OversoldLevel = 8; // Oversold level
input int TakeProfitPips = 175; // Take profit in pips
input int StopLossPips = 5; // Stop loss in pips
input double MaxLotSize = 0.1; // Maximum lot size
input int MaxSpread = 1000; // Maximum allowed spread in pips
input int MaxDuration = 270; // Maximum trade duration in hours
input bool UseStopLoss = false; // Use stop loss
input bool UseTakeProfit = false; // Use take profit
input bool UseRSIExit = true; // Use RSI for exit
input double RSIExitLevel = 55; // RSI level to exit (50 = neutral)
input bool CloseOutsideSession = false; // Close trades outside Asian session
input group "=== Panel ==="
input color PanelBackground = clrBlack; // Panel background color
input color PanelText = clrWhite; // Panel text color
input int PanelX = 10; // Panel X position
input int PanelY = 20; // Panel Y position
input group "=== Identity ==="
input int InpMagicNumber = 22218104; // Magic Number
input string InpTradeComment = "Psgrowth.com Expert_18104"; // Trade Comment
// Global variables
CTrade trade;
int rsiHandle;
bool isPositionOpen = false;
double positionOpenPrice = 0;
datetime positionOpenTime = 0;
ENUM_POSITION_TYPE lastPositionType = POSITION_TYPE_BUY;
bool sessionCloseAttempted = false; // Track if we've attempted to close positions for current session
// RSI crossover variables
double rsiCurrent = 0;
double rsiPrevious = 0;
double rsiPrevious2 = 0;
bool rsiCrossedOverbought = false;
bool rsiCrossedOversold = false;
bool rsiCrossedExitLevel = false;
// Panel objects
string panelName = "RSIPanel";
int panelWidth = 200;
int panelHeight = 200;
int labelHeight = 20;
int labelSpacing = 5;
// Session times (UTC)
const int AsianSessionStart = 0; // 00:00 UTC
const int AsianSessionEnd = 8; // 08:00 UTC
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.