Specification
//+------------------------------------------------------------------+
//| XAUUSD Ultimate Institutional EA |
//| Features: |
//| - True swing-based market structure |
//| - BOS sniper entries on M5 |
//| - Liquidity sweep filter |
//| - Partial TP + breakeven |
//| - Visual BOS, swings, liquidity |
//| - ATR-based dynamic SL |
//| - Trailing stop |
//| - Session filter (London + NY) |
//| - Risk management (1% per trade) |
//+------------------------------------------------------------------+
#property strict
#include <Trade/Trade.mqh>
CTrade trade;
//================ INPUTS =================
input double RiskPercent = 1.0; // % risk per trade
input double RR = 2.0; // Target RR
input double PartialClosePercent = 50.0; // % to close at first TP
input int SL_Buffer_Points = 400; // SL buffer (XAU volatility)
input int MaxSL_Points = 3000; // Skip trades if SL too wide
input ENUM_TIMEFRAMES HTF = PERIOD_H1; // Higher timeframe
input ENUM_TIMEFRAMES LTF = PERIOD_M5; // Lower timeframe
input int LondonStart = 10; // London session start
input int LondonEnd = 13; // London session end
input int NYStart = 15; // NY session start
input int NYEnd = 18; // NY session end
input bool UseNewsFilter = true; // Toggle news filter
input int NewsPauseBefore = 30; // Minutes before news
input int NewsPauseAfter = 30; // Minutes after news
input int FractalDepth = 2; // For true swing detection
input int ATR_Period = 14; // ATR period
input double ATR_Multiplier = 1.5; // ATR multiplier for SL
input double TrailingStart = 1.0; // RR ratio to start trailing
input double TrailingStep = 50; // Points per trailing move
//================ GLOBALS =================
datetime LastTradeDay;
bool PartialTaken = false;
bool BuyLiquidityTaken = false;
bool SellLiquidityTaken = false;
double LastSwingHigh = 0;
double PrevSwingHigh = 0;
double LastSwingLow = 0;
double PrevSwingLow = 0;
//================ SESSION CHECK =================
bool InSession()
{
int h = TimeHour(TimeCurrent());
return (h>=LondonStart && h<=LondonEnd) || (h>=NYStart && h<=NYEnd);
}
//================ TRUE SWING DETECTION =================
void DetectSwings()
{
for (int i = 5; i < 100; i++)
{
double fh = iFractals(_Symbol, HTF, MODE_UPPER, i);
double fl = iFractals(_Symbol, HTF, MODE_LOWER, i);
if (fh != 0)
{
PrevSwingHigh = LastSwingHigh;
LastSwingHigh = fh;
}
if (fl != 0)
{
PrevSwingLow = LastSwingLow;
LastSwingLow = fl;
}
if (PrevSwingHigh > 0 && PrevSwingLow > 0) break;
}
}
//================ MARKET STRUCTURE =================
bool BullishStructure()
{
DetectSwings();
return (LastSwingHigh > PrevSwingHigh &&
LastSwingLow > PrevSwingLow);
}
bool BearishStructure()
{
DetectSwings();
return (LastSwingHigh < PrevSwingHigh &&
LastSwingLow < PrevSwingLow);
}
//================ LOT CALCULATION =================
double LotByRisk(double sl_points)
{
double bal = AccountInfoDouble(ACCOUNT_BALANCE);
double riskMoney = bal * RiskPercent / 100.0;
double tickVal = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double tickSz = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
double lot = riskMoney / (sl_points * tickVal / tickSz);
return NormalizeDouble(lot, 2);
}
//================ LIQUIDITY SWEEP =================
void DetectLiquiditySweep(double ltf_low, double ltf_high, double close)
{
BuyLiquidityTaken = (ltf_low < LastSwingLow && close > LastSwingLow);
SellLiquidityTaken = (ltf_high > LastSwingHigh && close < LastSwingHigh);
// Visualize sweeps
if(BuyLiquidityTaken)
DrawLabel("LIQ_SWEEP_BUY", TimeCurrent(), LastSwingLow, "Sell-side Liquidity Taken", clrDodgerBlue);
if(SellLiquidityTaken)
DrawLabel("LIQ_SWEEP_SELL", TimeCurrent(), LastSwingHigh, "Buy-side Liquidity Taken", clrOrangeRed);
}
//================ DRAWING FUNCTIONS =================
void DrawLine(string name, datetime t1, double p1, datetime t2, double p2, color clr)
{
ObjectDelete(0, name);
ObjectCreate(0, name, OBJ_TREND, 0, t1, p1, t2, p2);
ObjectSetInteger(0, name, OBJPROP_COLOR, clr);
ObjectSetInteger(0, name, OBJPROP_WIDTH, 2);
}
void DrawLabel(string name, datetime t, double p, string text, color clr)
{
ObjectDelete(0, name);
ObjectCreate(0, name, OBJ_TEXT, 0, t, p);
ObjectSetText(name, text, 10, "Arial", clr);
}
//================ ATR =================
double ATR(int period, ENUM_TIMEFRAMES tf)
{
return iATR(_Symbol, tf, period, 0);
}
//================ PARTIAL TP + BREAKEVEN =================
void ManagePosition()
{
if (!PositionSelect(_Symbol)) return;
double entry = PositionGetDouble(POSITION_PRICE_OPEN);
double sl = PositionGetDouble(POSITION_SL);
double tp = PositionGetDouble(POSITION_TP);
double vol = PositionGetDouble(POSITION_VOLUME);
int type = PositionGetInteger(POSITION_TYPE);
double price = (type==POSITION_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_BID)
: SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double risk = MathAbs(entry - sl);
double oneR = (type==POSITION_TYPE_BUY) ? entry + risk : entry - risk;
// Partial TP
if (!PartialTaken &&
((type==POSITION_TYPE_BUY && price >= oneR) ||
(type==POSITION_TYPE_SELL && price <= oneR)))
{
trade.PositionClosePartial(_Symbol, vol * PartialClosePercent / 100.0);
trade.PositionModify(_Symbol, entry, tp); // move SL to breakeven
PartialTaken = true;
}
// Trailing Stop
double rrAchieved = (type==POSITION_TYPE_BUY) ? (price - entry)/risk : (entry - price)/risk;
if(rrAchieved >= TrailingStart)
{
double new_sl;
if(type==POSITION_TYPE_BUY)
new_sl = price - TrailingStep*_Point;
else
new_sl = price + TrailingStep*_Point;
if((type==POSITION_TYPE_BUY && new_sl > sl) ||
(type==POSITION_TYPE_SELL && new_sl < sl))
{
trade.PositionModify(_Symbol, new_sl, tp);
}
}
}
//================ NEWS FILTER PLACEHOLDER =================
bool NewsSafe()
{
if(!UseNewsFilter) return true;
// Placeholder: safe, can integrate news API
return true;
}
//================ MAIN LOGIC =================
void OnTick()
{
if(_Symbol != "XAUUSD") return;
if(!InSession()) return;
if(!NewsSafe()) return;
ManagePosition();
if(PositionsTotal() > 0) return;
double close = iClose(_Symbol, LTF, 1);
double prevHigh = iHigh(_Symbol, LTF, 2);
double prevLow = iLow(_Symbol, LTF, 2);
DetectLiquiditySweep(prevLow, prevHigh, close);
double atr = ATR(ATR_Period, LTF);
//================ BUY =================
if(BullishStructure() && BuyLiquidityTaken && close > prevHigh)
{
double entry = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double sl = entry - atr * ATR_Multiplier;
double sl_points = (entry - sl)/_Point;
if(sl_points > MaxSL_Points) return;
double tp = entry + (entry - sl) * RR;
double lot = LotByRisk(sl_points);
trade.Buy(lot, _Symbol, entry, sl, tp);
PartialTaken = false;
DrawLine("BOS_BUY", iTime(_Symbol,LTF,2), prevHigh, iTime(_Symbol,LTF,1), close, clrLime);
DrawLabel("BOS_BUY_LABEL", iTime(_Symbol,LTF,1), close, "BOS BUY", clrLime);
}
//================ SELL =================
if(BearishStructure() && SellLiquidityTaken && close < prevLow)
{
double entry = SymbolInfoDouble(_Symbol, SYMBOL_BID);
double sl = entry + atr * ATR_Multiplier;
double sl_points = (sl - entry)/_Point;
if(sl_points > MaxSL_Points) return;
double tp = entry - (sl - entry) * RR;
double lot = LotByRisk(sl_points);
trade.Sell(lot, _Symbol, entry, sl, tp);
PartialTaken = false;
DrawLine("BOS_SELL", iTime(_Symbol,LTF,2), prevLow, iTime(_Symbol,LTF,1), close, clrRed);
DrawLabel("BOS_SELL_LABEL", iTime(_Symbol,LTF,1), close, "BOS SELL", clrRed);
}
}
Responded
1
Rating
Projects
30
57%
Arbitration
0
Overdue
1
3%
Working
2
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
3
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
4
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
5
Rating
Projects
3
33%
Arbitration
2
0%
/
100%
Overdue
0
Free
6
Rating
Projects
15
13%
Arbitration
6
0%
/
67%
Overdue
2
13%
Free
7
Rating
Projects
8
0%
Arbitration
8
13%
/
88%
Overdue
0
Free
8
Rating
Projects
19
42%
Arbitration
3
0%
/
67%
Overdue
3
16%
Free
9
Rating
Projects
0
0%
Arbitration
1
0%
/
100%
Overdue
0
Free
Similar orders
MT5 Expert Advisor Developer | Structure & Risk Systems
300 - 700 USD
I will develop a custom MetaTrader 5 Expert Advisor based on the client’s provided trading rules. The EA will include proper entry and exit logic, stop loss and take profit handling and stable risk management. The code will be clean, non-repainting, MT5 compliant, and delivered with full source files. "Risk Disclosure : Trading in financial markets involves risk, and results depend on market conditions, broker
I need a professional developer to build a Telegram-to-MetaTrader trade copier system. Project overview: - A Telegram bot will read trade signals from a Telegram channel - Trades will be automatically executed on MT4 and/or MT5 accounts - The system must support copying trades to multiple MetaTrader accounts - Execution should work even when the user is offline Functional requirements: - Structured signal format
I need a MetaTrader 5 Expert Advisor (EA) built based on a clear, rule-based strategy for XAUUSD on the M5 timeframe. Indicators used: EMA 50 (Exponential, Close) EMA 200 (Exponential, Close) RSI (14) Stochastic Oscillator (14,3,3) BUY rules: Price above EMA 50 and EMA 200 RSI between 10 and 25 Stochastic crosses upward from below 20 Bullish candle close SELL rules: Price below EMA 50 and EMA 200 RSI between 80 and
Expert Advisor (EA) Development Specification
30 - 100 USD
Platform: MT5 | Instrument: XAUUSD | Broker: IC Markets (ECN) Style: High-speed scalping / short-term momentum | Timeframes: M1 & M5 | Operation: Fully automated, 24/5 Overview We seek an experienced MQL5 developer to build a fast, reliable EA for live trading. The EA must: Detect symbol specifications automatically (digits, tick size, contract size) Operate continuously without manual intervention Follow logical
Convert the indicator available in trade view named "Support resistance diagonal" by Pikusov to use in MT5 platform. Also need get some alerts in mobile (any social media app/ MT5) if crossing the support/ resistance lines
Need Web Trade Copier System
50+ USD
Hello great developers, I need a very fast and hardworking deliver who know both back end and front end of trade copier system. I need a web based trade copier application, i already create the website aspect, only need the copier to be included. I actually have a limited time, and no room for unprofessional developers, kindly send your applications if you can actually get it done in the space of 2 days and my budget
EA Development mentor
30 - 40 USD
am looking for a Mentor that has verifiable experience trading forex and commodities. Somebody who has a couple years experience in failures and successes. I am not a beginner. I have modest success already with discretionary trading. I have had an EA created that is very promising. It has extensive testing with very good results. The idea would be to work together advancing the existing EA and build additional EA's
Existing EA
30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or
Looking for MT5 Developer
30 - 120 USD
Looking for an MT5 developer to build an automated trading bot that executes trades based on indicator signals. The bot should support flexible inputs, work across Forex, commodities, and crypto, and allow basic configuration options. If you're experienced with MT5 EAs and indicator integration, please reach out
I want a reliable and broker-independent copy-trading solution that copies trades from a master MT5 account to multiple MT4 and/or MT5 client accounts. The system is designed for stable live trading and works with any broker, handling common differences in symbols, pricing, and execution. The copier supports full trade synchronization, including trade opening, closing, partial closes, and SL/TP modifications, with
Project information
Budget
300+ USD
Deadline
from 1 to 10 day(s)
Customer
Placed orders1
Arbitrage count0