Architecture Engine Risk Compliance Backtest Aurus V5 →
Institutional Directional Gold EA

Not Just An EA.
A Rules-Based System.

Lily EA v4.0 does not rely on simple crossovers. It reads market structure, macroeconomic correlation, and real-time order flow to execute precision trades on XAUUSD, governed by an Adaptive Risk Engine built to pass Prop Firm challenges.

Platform: MT5 Instrument: XAUUSD

The Foundation

The Five Pillars of Lily v4.0

Every trade is the result of five interconnected systems working synchronously.

01

Signal Engine

A composite 4-component scoring system that evaluates the market. It only acts when the evidence across VP, DXY, EMA, and RSI is strong enough.

02

Pre-Trade Filters

A protective layer running independently. It guards against bad conditions like wrong sessions, news events, excessive spreads, and hostile market regimes.

03

Adaptive Risk

A self-recalibrating engine adjusting position size based on recent broker trade history, actual market volatility, and equity curve momentum.

04

Trade Management

Actively manages open positions with structure-aware trailing stops behind HVNs and dynamic partial closes at the POC.

05

Prop Firm Compliance

A dedicated layer strictly monitoring daily drawdown, total drawdown, trailing drawdown, and weekend closes to keep the account compliant with rules like The5ers.

Market Regime (ADX Filter)

  • Ranging (ADX < 35): Normal operation — full entries.
  • Trending (ADX 35-50): Reduced lot size (75%) & stronger signal needed.
  • Volatile (ADX > 50): All new entries paused entirely.

Session Filter

Session Time (GMT) Status
Asian 00:00 – 08:00 Blocked
London 08:00 – 13:00 Active
London/NY 13:00 – 16:00 Preferred (1.2x Lots)
New York 16:00 – 21:00 Active
Rollover 21:00 – 00:00 Blocked / SL to BE

Before A Trade Is Taken

The Pre-Trade Filter Layer

If even one condition fails, no trade is placed.

EA Readiness & Spread Check

+

Volume profile must have 100+ bars, ATR must be available, and the dynamic spread baseline (50+ samples) must be stable. Spreads exceeding 2.5x the average automatically block entries.

News & Rollover Protection

+

Uses MT5's economic calendar to halt trading 30-60 mins before and 15-30 mins after high-impact events. Protects against Wednesday rollover swap-widening by moving stops to Breakeven.

SL Delay & Cooldown

+

Mandatory 5-minute pause after an SL hit. If 3 stop losses occur within an hour, a strict circuit breaker pauses the system. Guaranteed 2-minute re-entry cooldown.

Directional Logic

The 4-Component Signal Engine

Score = (VP × 2.0) + (DXY × 2.0) + (EMA × 1.5) + (RSI × 1.5)

Volume Profile Mean-Reversion (Primary)

Maps institutional price activity. When price hits the Value Area High (VAH), it sells targeting the Point of Control (POC). When at the Value Area Low (VAL), it buys. Verified by tick-level Delta Volume order flow.

DXY VW-ROC (Intermarket Correlation)

Reads the US Dollar Index using a Volume-Weighted Rate of Change. If DXY drops heavily on high volume, it signals a Gold buy. This isn't just price—it's macroeconomic edge.

Momentum Alignment (EMA & RSI)

EMA 5/20 measures session bias distance, and a graduated RSI dictates extreme overbought/oversold states (scaling from ±0.3 to ±1.0).

Volume Profile Visualization

Execution Thresholds

  • ±0.65+ (Very Strong): Trades in all regimes
  • ±0.45 – 0.64 (Strong): Required to trade in Trending regime
  • ±0.25 – 0.44 (Moderate): Allowed in Ranging regime
  • < ±0.24 (Weak): Trade Blocked

Execution

Precision Risk Sizing & ATR Limits

Lily does not use fixed lots or fixed pip SL/TP. Everything is dynamic relative to mathematically defined market risk.

Multi-Layer Cap Logic

Calculates base % risk via Tick Value, then applies a strict hard ceiling, equity risk caps (max 5%), margin safety caps (max 80%), prop firm loss buffers, and finally normalizes to broker lot steps.

ATR-Adaptive Stops & Targets

SL: 1.75x ATR
TP: 5.0x ATR

Creates an asymmetric R:R of ~2.85:1. Stops widen organically during news shocks to prevent hunting, and tighten during consolidations to improve risk efficiency.

Adaptive Risk Dashboard

The Brain

The Adaptive Risk Engine

The most sophisticated piece of Lily v4.0. It continuously monitors performance and recalibrates exposure.

Restart Safety & True Day Balance

+

On every restart, Lily rebuilds its entire state from actual broker trade history. It calculates the True Day Open Balance preventing misreporting of daily limits after VPS crashes.

Time-Decayed Loss Streaks

+

Rebuilds consecutive losses but applies a 50% discount to losses 24h old, and forgets losses past 48h. A streak of 2 lowers lots to 75%. A streak of 5 halts trading fully.

Equity Curve EMAs

+

Replays the last 30 trades to build Fast & Slow EMAs on its own returns. If the strategy goes "out of form" (Fast < Slow), it automatically scales risk down 25%.

ATR Volatility Scaling

+

If the current ATR spikes to >1.5x its average, lot size is slashed to 75%. If >2.0x average, slashed to 50%—forcing survival during market shocks.

Post-Entry

Active Trade Management

🛡️

Structure-Aware Trailing Stops

Instead of trailing by a fixed pip distance, Lily scans the Volume Profile for High Volume Nodes (HVNs). The trailing stop tucks itself behind these heavy volume zones, using them as structural barricades against price spikes.

💰

Dynamic Partial Closes at POC

When the trade reaches the original mean-reversion target—the Point of Control (POC)—the EA closes 40% to secure edge. The Stop Loss on the remaining 60% is instantly moved to Breakeven.

Prop Firm Security

The5ers Compliance Layer

Lily v4.0 explicitly protects against drawdowns and is architecturally incapable of violating The5ers prohibited practices.

Drawdown Halts

Monitors Initial Balance. When 80% of Daily Loss (4%) or Total Loss (8%) is hit, trading is forcefully halted. Trailing DD tracking is built-in for standard FTMO/MFF models.

Equity HWM Protect

A separate safeguard protecting the account from recovery failure. If equity drops below 85% of its all-time High-Water Mark, all operations cease.

Weekend & Daily Targets

Automatic Friday 22:00 GMT closures prevent weekend gaps. Hitting a 2% Daily Profit target smoothly shifts the EA into 'Conservative Mode'.

The5ers Prohibited Practice Checklist

PASS Arbitrage Trade Exploitation
PASS High-Frequency Trading (HFT)
PASS Bulk / Multi-Trade Opening
PASS News Bracketing (Stop Orders)
PASS Exploiting Feed Glitches
PASS Trade Coordination / Copying
PASS One-Sided Directional Bets
PASS EA Scalping During Rollover
PASS Shared 3rd Party EA Footprints
PASS Missing Source Code Ownership
PASS Sub-second Tick Scalping
PASS Hedge / Reverse Arbitrage

Note: Rollover scalping is explicitly blocked. The EA blocks new entries from 21:00 GMT and moves open stops to BE before swap widening occurs.

Proof of Concept

Backtest Performance

Real data over extended periods on XAUUSD.
Period: 1-Jan-2026 to 29-Mar-2026

MT5 Strategy Tester Report - Lily V4
Total Net Profit $1,185.75
Max Drawdown 5.13% ($317.73 Equity DD)
Profit Factor 1.45
Win Rate 74.20% (345 Total Trades)
History Quality: 98%
Expected Payoff: 3.44
Sharpe Ratio: 8.89
Recovery Factor: 3.73
Long Trades (Won %): 124 (73.39%)
Short Trades (Won %): 221 (74.66%)
Max Consecutive Wins: 23 ($269.41)
Max Consecutive Losses: 7 (-$172.95)
Raw Backtest Data (1-Jan-2026 to 29-Mar-2026)
Click to Expand Report
Complete Backtest Data from 1-Jan-2026 to 29-Mar-2026
Expanded Backtest