指定
//+------------------------------------------------------------------+
//| 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);
}
}
応答済み
1
評価
プロジェクト
33
52%
仲裁
1
100%
/
0%
期限切れ
1
3%
暇
2
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
3
評価
プロジェクト
2
0%
仲裁
0
期限切れ
0
仕事中
4
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
5
評価
プロジェクト
3
33%
仲裁
2
0%
/
100%
期限切れ
0
暇
6
評価
プロジェクト
15
13%
仲裁
6
0%
/
67%
期限切れ
2
13%
暇
7
評価
プロジェクト
8
0%
仲裁
8
13%
/
88%
期限切れ
0
暇
8
評価
プロジェクト
19
42%
仲裁
3
0%
/
67%
期限切れ
3
16%
仕事中
9
評価
プロジェクト
1
0%
仲裁
1
0%
/
100%
期限切れ
1
100%
仕事中
10
評価
プロジェクト
5
60%
仲裁
1
0%
/
0%
期限切れ
2
40%
暇
パブリッシュした人: 1 code
11
評価
プロジェクト
144
46%
仲裁
20
40%
/
15%
期限切れ
32
22%
仕事中
12
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
仕事中
13
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
類似した注文
I need a developer to start robot from scratch based on existing EA that is running live. I do not have the source file as my previous coder did not give it to me. What I do have is the investor password which is running the EA from the coder side but not from my end. I like someone to monitor the account and re create the same system for me
Project Overview: I am looking for a highly experienced MetaTrader 4 (MQL4) developer to build a sophisticated automated trading system. This is not a standard grid bot; it requires complex trade management, dynamic exposure rebalancing, and a custom "Salami" liquidation module for partial loss mitigation . Key Features to Implement: Virtual Grid & Dynamic Trend: Price-action-based grid triggers without pending
We are looking for a professional developer or trader who already has a proven profitable EA or strategy based mainly on price action logic. Important requirements: No Martingale No Grid No Micro-scalping Avoid heavy indicator-based strategies Strategy should be based mainly on price behavior / market structure We are not looking for aggressive systems that promise unrealistic returns. Our focus is on stable
Martingale Risk Manager EA
99 - 199 USD
I run an ea it makes good profits bit that one bad grid blows up the account. I want an EA which runs parallel to it which can intelligently close bad trades or grids. It shouldn't close recoverable trades but close very bad entries and grids. It can even close with hedging. The goal recover max and also not blow up the account
I am looking for an expert MQL5 developer to build a high-precision Hedging System between two different MT5 brokers running on the same local PC. Core Objective: Execute opposite (inverse) trades between a Master and Slave account (e.g., Master BUY = Slave SELL, Master SELL = Slave BUY). The Challenge: Standard "Trade Copiers" are insufficient as they cannot prevent single-legged exposure when using manual trading
Help for Money Management
30 - 35 USD
I want robot that can help me trade and make some money so that I can be able to learn from it while I'm still in depot account now.Is how it gonna help me with some money
Message to Developer + Request for Best Settings
30 - 50 USD
Hello, I have two requests: First: Feature Modification Request Currently, the EA places only one pending order at a time. I want to modify this to place two opposite pending orders (Buy Stop and Sell Stop) simultaneously, with the distance between them aligned with the existing Breakeven and Trailing Stop settings in the bot. How it should work: The EA places a Buy Stop above current price and a Sell Stop
Hello, I need a professional MT5 Expert Advisor for currency trading. PAIRS: EURUSD, GBPUSD, USDJPY, USDCHF TIMEFRAME: M15 STRATEGY: - EMA 8 cross EMA 21 (entry signal) - EMA 50 for trend filter - RSI 14 confirmation (Buy > 52, Sell < 48) - No trade if RSI > 75 or < 25 SESSION: London + New York only 07:00 to 17:00 GMT No weekend trading TRADE MANAGEMENT: - Lot size: 0.06 - Take Profit: $15 per trade - Stop Loss: $8
I need a MetaTrader 5 Expert Advisor (EA) for Forex trading. Account size: $1000 Requirements: 1. The EA should work only on Forex pairs. 2. Automatic Buy and Sell trades. 3. Lot size starting from 0.04. 4. Stop Loss and Take Profit settings. 5. Only one trade at a time. 6. Works on pairs like EURUSD, GBPUSD, USDJPY etc. 7. Risk management suitable for a $1000 account. 8. Easy settings for lot size, SL, TP and risk
I want to design an EA that can identify key Supports and Resistances. This should be able to work on any timeframe from 1 minute to 1 hour (i.e 1 minute, 5 minutes, 15 minutes and 1 hour time frames.) The EA should be able to determine a Fibonacci retracement from a support and the next resistance point in an uptrend and vice versa (i.e the EA should be able to determine a Fibonacci retracement from a resistance and
プロジェクト情報
予算
300+ USD
締め切り
最低 1 最高 10 日