Awesome—here’s a clean, developer-ready EA specification template you can paste into an MQL5 Freelance order. It’s detailed enough that a good coder can deliver first try, and it reflects everything we built together.
---
Project: “DrVikramJ Strategy EA” (MT5, MQL5)
1) Scope & Goal
Build a MetaTrader 5 Expert Advisor implementing an ICT/SMC-style trend strategy with:
Trend filter via EMA(20/50/200)
RSI(14) directional confirmation
Liquidity Grab (wick sweep) as trigger
Optional OTE (50–100%) entry zone filter
Optional OB/FVG gate (simple)
Single averaging entry at 61.8%
SL at swept wick ± 5 pips (configurable buffer if needed)
TP by Risk:Reward (default 1.80)
Two independent streams: M15 and H1 (separate magic numbers)
No partials, no news filter
Deliver .mq5 source (not only .ex5), with comments and clear inputs.
---
2) Platform & Compatibility
Platform: MetaTrader 5 (MQL5)
File type: .mq5
Language level: #property strict
No DLLs, no external files required
Uses standard library <Trade/Trade.mqh>
---
3) Symbols & Timeframes
Works on: major FX pairs, XAUUSD, indices like US100 (NAS100)
Timeframes used by the EA: M15 and H1
Both streams can be enabled/disabled independently.
---
4) Inputs (final names & defaults)
// Identification & streams
input long MagicBase = 772205; // signed, matches POSITION_MAGIC
input int MagicOffset_M15 = 15; // magic = MagicBase + this
input int MagicOffset_H1 = 60;
input bool Use_M15 = true;
input bool Use_H1 = true;
// Risk & trade limits
input double Lots = 0.00; // 0 => auto lot
input double AutoLotPerEquity = 300.0; // 0.01 lot per $300 equity
input int MaxPositionsPerSymbol = 2; // entry + one averaging
input int MinBarsBetweenEntries = 2; // per active TF
// Indicators
input int EMA_Fast = 20;
input int EMA_Mid = 50;
input int EMA_Slow = 200;
input int RSI_Period = 14;
input double RSI_Buy_Min = 50.0;
input double RSI_Sell_Max = 50.0;
// Liquidity Grab (LG)
input int LgLookbackBars = 20; // prior swing window
input double WickToBodyMin = 1.50; // wick >= X * body
// Entry filters
input bool UseOTE = true; // require 50–100% zone
input int OB_Window = 15; // simple OB gate window
input int FVG_Window = 15; // simple FVG gate window
input bool Require_OB_or_FVG = false; // optional extra gate
// Targets & risk
input double RiskReward = 1.80; // TP = RR * risk
input bool UseStructureTargets = false; // reserved (off now)
// Pips & guards
input double PipSizeOverride = 0.0; // 0=auto heuristic
input double MaxSLDistancePoints = 0.0; // 0=disabled max SL distance
// Averaging
input bool AllowAveraging = true; // exactly one extra at 61.8%
// UI & logs
input bool ShowHUD = true;
input bool VerboseLogs = true;
---
5) Definitions & Calculations
5.1 Pip size (heuristic)
If PipSizeOverride > 0: use it
Else if symbol contains "JPY": pip = 0.01
Else if symbol length = 6 (standard FX): pip = 0.0001 (or SYMBOL_POINT if 4 digits)
Else (metals/indices/CFDs): pip = 10 * SYMBOL_POINT
5.2 Trend filter
Read EMA(20), EMA(50), EMA(200) at shift=1 (last closed bar).
Trend = UP if EMA20 > EMA50 > EMA200; DOWN if EMA20 < EMA50 < EMA200; else NONE (no trading).
5.3 RSI gate
RSI(14) at shift=1.
In UP trend require RSI ≥ RSI_Buy_Min (default 50).
In DOWN trend require RSI ≤ RSI_Sell_Max (default 50).
5.4 Liquidity Grab (LG) trigger
Lookback window N = LgLookbackBars (min 5).
Build prior High/Low using bars [2..N+1] (skip current bar; check the last closed bar at shift=1).
For BUY LG:
Candle at shift=1 makes a lower wick below priorLow,
Closes back above priorLow,
Lower wick length ≥ WickToBodyMin × candle body.
For SELL LG:
Candle at shift=1 makes an upper wick above priorHigh,
Closes back below priorHigh,
Upper wick length ≥ WickToBodyMin × candle body.
5.5 BOS/ChoCH confirmation (simple)
Over a short window (default 10 bars, shift=1):
For UP trend: close(1) > max(high[2..window+1]).
For DOWN trend: close(1) < min(low[2..window+1]).
5.6 Recent leg & OTE zone
Find swing leg over ~30 bars (shifted history), selecting most recent high/low consistent with trend.
OTE zone:
UP: price in [50%, 100%] measured from leg high down to leg low.
DOWN: price in [50%, 100%] measured from leg low up to leg high.
If UseOTE=true, require current bid/ask (depending on direction) to be inside zone.
5.7 Optional OB/FVG gate (simple)
OB gate (very simple proxy): in the last OB_Window bars, presence of a large body candle in trend direction with body/range > 0.6.
FVG gate (very simple proxy):
UP: high of bar i-1 < low of bar i+1 (gap)
DOWN: low of bar i-1 > high of bar i+1
If Require_OB_or_FVG=true, require (OB or FVG) to pass.
5.8 Entry, SL, TP
Side: trend-aligned (UP→BUY, DOWN→SELL) and LG direction must match.
SL:
BUY: min(sweptPrice, leg.low) − 5 pips
SELL: max(sweptPrice, leg.high) + 5 pips
Normalize to symbol digits.
TP: entry ± RiskReward * |entry − SL|
Optional guard: if MaxSLDistancePoints > 0 then abs(entry−SL)/point must be ≤ this.
5.9 Averaging (exactly one)
Only if AllowAveraging=true.
One additional position in same direction, only if current price is at/through the 61.8% retracement of the leg (± tolerance 5 points).
Recompute SL/TP using same rules; comment “DVJ-Avg”.
Do not open more than 2 positions per symbol/direction (MaxPositionsPerSymbol covers it).
5.10 Position counting & magic numbers
Each TF uses its own magic:
M15: MagicBase + MagicOffset_M15
H1: MagicBase + MagicOffset_H1
Important: use long for values from PositionGetInteger(POSITION_MAGIC) and compare as long. (No ulong.)
Count only positions on current Symbol() and with the two EA magic numbers.
5.11 Bar spacing guard
After an entry on a TF, wait MinBarsBetweenEntries * PeriodSeconds(TF) seconds before allowing a new entry on that TF.
5.12 Spread sanity
Soft check only: ASK >= BID. (No strict spread filter unless requested.)
5.13 Auto lots
If Lots==0: lots = max(0.01, floor(Equity/AutoLotPerEquity)*0.01), snapped to SYMBOL_VOLUME_STEP.
---
6) Execution Model
Event-driven on OnTick().
For each enabled TF (M15, H1):
1. Detect new closed bar.
2. Enforce trade limits & spread sanity.
3. Trend → RSI → LG → BOS/ChoCH → Leg → OTE → optional OB/FVG → Entry.
4. Market order with SL/TP, Deviation 20 points.
5. Averaging manager checks 61.8% rule.
---
7) UI (HUD)
Three label lines in top-left:
L1: “DVJ EA – Trend + RSI + LG + OTE”
L2: “OpenPos: X | Max/Sym: Y”
L3: “Time: yyyy.mm.dd hh:mm:ss”
ASCII-only text (no emoji or “smart quotes”).
---
8) Logging
When VerboseLogs=true, print key decisions and order results (OPEN/AVERAGE, prices, SL/TP, lots).
On failure, print GetLastError() code.
---
9) Code Requirements
Clean, commented MQL5 code.
Use <Trade/Trade.mqh> (CTrade).
#property strict.
No global statics that break multi-symbol use.
Deterministic behavior: all calculations at shift=1 (closed bar), not on bar 0.
---
10) Deliverables
1. DrVikramJ_Strategy_EA.mq5 (source).
2. Compiled .ex5.
3. A short README:
Inputs & recommended defaults
How pip size is computed
Known limitations
4. Two sample .set files (M15 and H1).
---
11) Acceptance Tests (developer must pass)
Compilation: no errors/warnings with #property strict.
Magic filter: positions counted only for magic = MagicBase+15 and MagicBase+60.
Trigger logic:
When a bar meets LG + trend + RSI + BOS/ChoCH (+ OTE if on), EA opens 1 market order with SL/TP.
With AllowAveraging=true, a second order can open only when price reaches ~61.8% (±5 points).
Limits:
Never exceed MaxPositionsPerSymbol.
Entry spacing guard respected.
HUD renders 3 lines without garbled characters.
Lot sizing: with equity $300 and Lots=0, first order uses 0.01 (adjusted to volume step).
Type safety: PositionGetInteger(POSITION_MAGIC) handled as long.
---
12) Milestones (suggested)
1. Skeleton build (compiles, HUD, inputs, trade stubs) – 25%
2. Signal logic complete (EMA/RSI/LG/BOS/OTE/OB-FVG) – 35%
3. Risk mgmt & averaging (SL/TP, 61.8%, guards) – 25%
4. Final polish (README, sets, clean logs) – 15%
---
13) Rights & Support
Full ownership of source delivered to me.
30–60 days bug-fix warranty (developer to specify).
No reuse/resale without my permission.
---
14) Optional Future Add-ons (not in this order)
Session/time filters
News filter
Structure-based target ladders
Spread/commission aware position sizing
Partial close or trailing logic
---
Short Job Post (you can paste this)
> Need MQL5 EA for MT5 implementing my “DrVikramJ Strategy” (trend EMA20/50/200, RSI14 filter, Liquidity Grab trigger, BOS/ChoCH confirm, OTE 50–100% optional, optional OB/FVG gate, SL = wick ±5 pips, TP by RR, one averaging at 61.8%). Two streams (M15/H1) with separate magic numbers. Clean MQL5 with #property strict, <Trade/Trade.mqh>, no DLLs. Provide .mq5 source + .ex5, README, and two .set files.
I will test against acceptance criteria (compilation, logic passes, limits respected, HUD OK). Please share price, timeline, and sample code. Milestones via escrow.
---
If you want, I can also turn this into a .txt you can upload along with your job, and a .set pair with the defaults above.