指定
//+------------------------------------------------------------------+
//| ProTradingEA MT5 |
//| Fully MT5-compliant with MACD, Trailing Stop, Break-Even |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
CTrade trade;
// Optional override
input string SymbolOverride = ""; // leave blank to auto-detect
struct EASettings
{
int FastMAPeriod;
int SlowMAPeriod;
int RSIPeriod;
double RSIOverbought;
double RSIOversold;
int MACDFast;
int MACDSlow;
int MACDSignal;
double RiskPercent;
double ATRMultiplierSL;
double ATRMultiplierTP;
int ATRPeriod;
int TrailingStopPoints;
bool TradeLondonNY;
double PartialClosePercent;
string NewsStartTimes;
string NewsEndTimes;
};
EASettings settings;
double fastMA, slowMA;
double prevFastMA, prevSlowMA;
// MACD handles
int macdHandle;
double macdBuffer[], signalBuffer[], histBuffer[];
//+------------------------------------------------------------------+
//| Set defaults per symbol |
//+------------------------------------------------------------------+
void SetDefaults()
{
string sym = SymbolOverride != "" ? SymbolOverride : Symbol();
if(sym == "EURUSD") settings = {10,50,14,70,30,12,26,9,1.0,1.0,2.0,14,200,true,50,"13:30,15:00","14:30,15:30"};
else if(sym == "GBPUSD") settings = {12,55,14,70,30,12,26,9,1.0,1.2,2.2,14,250,true,50,"13:30,15:00","14:30,15:30"};
else if(sym == "USDJPY") settings = {10,50,14,70,30,12,26,9,1.0,1.0,2.0,14,150,true,50,"13:30,15:00","14:30,15:30"};
else settings = {10,50,14,70,30,12,26,9,1.0,1.0,2.0,14,200,true,50,"13:30,15:00","14:30,15:30"};
}
//+------------------------------------------------------------------+
//| Initialize EA |
//+------------------------------------------------------------------+
int OnInit()
{
SetDefaults();
// Create MACD handle
macdHandle = iMACD(Symbol(), PERIOD_CURRENT, settings.MACDFast, settings.MACDSlow, settings.MACDSignal, PRICE_CLOSE);
if(macdHandle == INVALID_HANDLE)
{
Print("Error creating MACD handle");
return INIT_FAILED;
}
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| Calculate lot size based on risk |
//+------------------------------------------------------------------+
double CalculateLotSize(double stopLossPoints)
{
double balance = AccountInfoDouble(ACCOUNT_BALANCE);
double riskAmount = balance * settings.RiskPercent / 100.0;
double tickValue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE);
double tickSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE);
double lot = riskAmount / (stopLossPoints * tickValue / tickSize);
double minLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);
double maxLot = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);
double step = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_STEP);
lot = MathMax(minLot, MathMin(maxLot, lot));
lot = MathFloor(lot/step)*step;
return NormalizeDouble(lot, 2);
}
//+------------------------------------------------------------------+
//| Check if trading is allowed (session + news filter) |
//+------------------------------------------------------------------+
bool IsTradingAllowed()
{
// Session filter
if(settings.TradeLondonNY)
{
int hour = TimeHour(TimeCurrent());
if(hour < 8 || hour > 17) return false;
}
// News filter
string starts[], ends[];
int startCount = StringSplit(settings.NewsStartTimes, ',', starts);
int endCount = StringSplit(settings.NewsEndTimes, ',', ends);
if(startCount != endCount) return true; // skip if mismatched
for(int i=0;i<startCount;i++)
{
int sh = StringToInteger(StringSubstr(starts[i],0,2));
int sm = StringToInteger(StringSubstr(starts[i],3,2));
int eh = StringToInteger(StringSubstr(ends[i],0,2));
int em = StringToInteger(StringSubstr(ends[i],3,2));
int curHour = TimeHour(TimeCurrent());
int curMin = TimeMinute(TimeCurrent());
if((curHour > sh || (curHour == sh && curMin >= sm)) &&
(curHour < eh || (curHour == eh && curMin <= em)))
return false;
}
return true;
}
//+------------------------------------------------------------------+
//| Manage positions: Trailing Stop, Break-Even, Partial Close |
//+------------------------------------------------------------------+
void ManagePositions()
{
if(!PositionSelect(Symbol())) return;
double openPrice = PositionGetDouble(POSITION_PRICE_OPEN);
double sl = PositionGetDouble(POSITION_SL);
double tp = PositionGetDouble(POSITION_TP);
double volume = PositionGetDouble(POSITION_VOLUME);
long type = PositionGetInteger(POSITION_TYPE);
double price = (type == POSITION_TYPE_BUY) ? SymbolInfoDouble(Symbol(), SYMBOL_BID) : SymbolInfoDouble(Symbol(), SYMBOL_ASK);
// Trailing Stop
if(type == POSITION_TYPE_BUY)
{
double newSL = price - settings.TrailingStopPoints * _Point;
if(newSL > sl && newSL > openPrice)
trade.PositionModify(Symbol(), newSL, tp);
// Break-Even + Partial Close
if(price - openPrice >= (tp - openPrice)/2 && sl < openPrice)
{
trade.PositionModify(Symbol(), openPrice, tp);
double closeVol = volume * settings.PartialClosePercent / 100.0;
trade.PositionClosePartial(Symbol(), closeVol);
}
}
if(type == POSITION_TYPE_SELL)
{
double newSL = price + settings.TrailingStopPoints * _Point;
if(sl == 0 || newSL < sl)
trade.PositionModify(Symbol(), newSL, tp);
// Break-Even + Partial Close
if(openPrice - price >= (openPrice - tp)/2 && (sl == 0 || sl > openPrice))
{
trade.PositionModify(Symbol(), openPrice, tp);
double closeVol = volume * settings.PartialClosePercent / 100.0;
trade.PositionClosePartial(Symbol(), closeVol);
}
}
}
//+------------------------------------------------------------------+
//| OnTick |
//+------------------------------------------------------------------+
void OnTick()
{
if(!IsTradingAllowed()) return;
// MAs
fastMA = iMA(NULL,0,settings.FastMAPeriod,0,MODE_SMA,PRICE_CLOSE,0);
slowMA = iMA(NULL,0,settings.SlowMAPeriod,0,MODE_SMA,PRICE_CLOSE,0);
prevFastMA = iMA(NULL,0,settings.FastMAPeriod,0,MODE_SMA,PRICE_CLOSE,1);
prevSlowMA = iMA(NULL,0,settings.SlowMAPeriod,0,MODE_SMA,PRICE_CLOSE,1);
// RSI
double rsi = iRSI(NULL,0,settings.RSIPeriod,PRICE_CLOSE,0);
// MACD
if(CopyBuffer(macdHandle,0,0,1,macdBuffer) <= 0) return; // Main
if(CopyBuffer(macdHandle,1,0,1,signalBuffer) <= 0) return; // Signal
double macdHist = macdBuffer[0] - signalBuffer[0];
// ATR for SL/TP
double atr = iATR(NULL,0,settings.ATRPeriod,0);
double slPoints = settings.ATRMultiplierSL * atr / _Point;
double tpPoints = settings.ATRMultiplierTP * atr / _Point;
double lot = CalculateLotSize(slPoints);
bool hasPosition = PositionSelect(Symbol());
// BUY signal
if(prevFastMA < prevSlowMA && fastMA > slowMA && rsi < settings.RSIOverbought && macdHist > 0 && !hasPosition)
{
double price = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
double sl = price - slPoints*_Point;
double tp = price + tpPoints*_Point;
trade.Buy(lot,Symbol(),price,sl,tp);
}
// SELL signal
if(prevFastMA > prevSlowMA && fastMA < slowMA && rsi > settings.RSIOversold && macdHist < 0 && !hasPosition)
{
double price = SymbolInfoDouble(Symbol(), SYMBOL_BID);
double sl = price + slPoints*_Point;
double tp = price - tpPoints*_Point;
trade.Sell(lot,Symbol(),price,sl,tp);
}
// Manage open positions
ManagePositions();
}
応答済み
1
評価
プロジェクト
660
32%
仲裁
43
44%
/
44%
期限切れ
11
2%
取り込み中
2
評価
プロジェクト
319
29%
仲裁
34
26%
/
65%
期限切れ
10
3%
暇
3
評価
プロジェクト
7
0%
仲裁
2
50%
/
0%
期限切れ
1
14%
仕事中
4
評価
プロジェクト
173
25%
仲裁
23
9%
/
78%
期限切れ
16
9%
仕事中
5
評価
プロジェクト
9
11%
仲裁
0
期限切れ
0
暇
6
評価
プロジェクト
159
43%
仲裁
3
33%
/
33%
期限切れ
1
1%
取り込み中
7
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
8
評価
プロジェクト
2
0%
仲裁
0
期限切れ
0
暇
9
評価
プロジェクト
33
24%
仲裁
3
33%
/
33%
期限切れ
4
12%
仕事中
10
評価
プロジェクト
288
35%
仲裁
18
22%
/
61%
期限切れ
42
15%
仕事中
11
評価
プロジェクト
89
28%
仲裁
24
13%
/
58%
期限切れ
7
8%
仕事中
12
評価
プロジェクト
19
26%
仲裁
0
期限切れ
3
16%
暇
13
評価
プロジェクト
20
0%
仲裁
10
0%
/
80%
期限切れ
6
30%
暇
14
評価
プロジェクト
559
35%
仲裁
80
31%
/
44%
期限切れ
203
36%
暇
15
評価
プロジェクト
125
24%
仲裁
23
26%
/
52%
期限切れ
8
6%
仕事中
16
評価
プロジェクト
5
0%
仲裁
3
33%
/
67%
期限切れ
2
40%
暇
17
評価
プロジェクト
169
38%
仲裁
9
78%
/
22%
期限切れ
15
9%
暇
18
評価
プロジェクト
373
72%
仲裁
19
32%
/
47%
期限切れ
14
4%
暇
パブリッシュした人: 14 codes
19
評価
プロジェクト
20
40%
仲裁
1
0%
/
100%
期限切れ
1
5%
暇
20
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
21
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
22
評価
プロジェクト
490
23%
仲裁
60
53%
/
25%
期限切れ
56
11%
取り込み中
23
評価
プロジェクト
31
55%
仲裁
3
33%
/
33%
期限切れ
0
仕事中
24
評価
プロジェクト
435
54%
仲裁
20
55%
/
15%
期限切れ
30
7%
仕事中
25
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
26
評価
プロジェクト
26
27%
仲裁
0
期限切れ
2
8%
暇
27
評価
プロジェクト
3380
68%
仲裁
77
48%
/
14%
期限切れ
342
10%
暇
パブリッシュした人: 1 code
28
評価
プロジェクト
1
100%
仲裁
0
期限切れ
0
暇
29
評価
プロジェクト
285
41%
仲裁
15
13%
/
47%
期限切れ
67
24%
暇
30
評価
プロジェクト
9
0%
仲裁
2
0%
/
50%
期限切れ
1
11%
仕事中
31
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
32
評価
プロジェクト
477
40%
仲裁
105
40%
/
24%
期限切れ
81
17%
取り込み中
パブリッシュした人: 2 codes
33
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
34
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
35
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
36
評価
プロジェクト
1
0%
仲裁
5
0%
/
100%
期限切れ
0
暇
37
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
38
評価
プロジェクト
14
43%
仲裁
0
期限切れ
3
21%
暇
類似した注文
I want a accurate indicator with buy and sell arrows or circle.. with exit points which trade xauusd and btcusd via weekend ... for small like R100 or 500 .... like which can grow small accounts with ... on for serious developer.. no bullshit ... I need on Friday please
I'd like to automate a relatively simple strategy in Sierra Chart, but I'd like to have it backtested and optimized first. Could we collaborate on this, and what would the cost be? Only bid if you think you can handle this project, and I want expert in sierra chart.. Thanks
EMA Cross Over boom and crash
30+ USD
I need an EMA crossover EA specifically for Boom and Crash. It should automatically buy and sell when crossovers happen. I want adjustable inputs for lot size, timeframe, and maximum loss. I’m keeping it simple because I’ve had bad experiences with EAs before. It should do only the job it is built for, properly and reliably. need someone who have already build EA or Indicator for Boom and Crash befor atleast 10
MT5 Trade copier
50+ USD
I have access to an MT5 account. I have investor access. I would like to know if someone could help me create a bot that copies only the trades made on XAU/USD in that account but in my MT4 account. In that account, many trades are made across various pairs, and I realize that the conditions of their account are not very favorable for the type of trading they do, as the commissions are very high. I have an account
Scanner EA for mt4 indicator
30 - 50 USD
Good day, I would like to have an expert advisor for my MT4 indicator (Major key alert) that can scan and provide push notification messages for entry opportunities across different time frames when a when a signal is identified
I need an expert advisor at around 30$-50$
30 - 50 USD
"I need an MT5 EA based on price action — liquidity sweep + hammer/shooting star reversal strategy. TREND: Identified by HH/HL for uptrend, LL/LH for downtrend on selected timeframe. No trade in ranging conditions. BUY SETUP: In uptrend, price retraces to swing low zone, wicks below it (liquidity sweep), hammer forms (lower wick min 2x body, closes above swept low). Buy stop entry at hammer high. SL below hammer
I need a professional MQL5 developer to finalize a Gold (XAUUSD) trading bot. The core layering and support-filter logic is already drafted. Key Requirements: Refine a hybrid Martingale/Layering volume calculation (1-10 / 11-20 reset logic). Implement a robust "Safety Mode" based on Daily Low price breaks. Ensure precise 6:00 AM Server Time reset for logic variables. Add professional error handling (Slippage
I want an order manager ea for XAUUSD
30 - 50 USD
I want a gold order management ea that should be like the below... Pending orders When I open one manual order, ea should be able to set 3 pending orders at x amount of pips below (if buy order) or above (if sell order) manual order entry. So like this Pending order 1 true or false Pending order pips away: 20. Pending order lot size:0.3 Pending order 2 true or false Pending order pips away: 40 Pending order lot
EA SPECIFICATION SHEET OBJECTIVE: Build a transparent, non-martingale, non-grid breakout EA for XAUUSD that trades only high‑quality breakouts during London + New York sessions. 1. TRADING INSTRUMENT - XAUUSD only - MT4 platform - 5‑digit ECN broker 2. CORE STRATEGY LOGIC (BREAKOUT + CONFIRMATION) A trade is allowed ONLY when ALL conditions are true: - Candle closes beyond previous high/low (no wick breakouts) -
I am looking to develop a custom Expert Advisor (EA) for MetaTrader (MT4/MT5) based on a defined technical analysis strategy and flexible risk management rules. The EA should operate on a chart and timeframe that I manually specify, with the ability to adapt its behavior dynamically when the timeframe is changed. Core Strategy Logic The EA will execute trades based on predefined technical analysis zones
プロジェクト情報
予算
30 - 200 USD
VAT(付加価値税) (20%):
6
-
40
USD
合計:
36
-
240
USD
開発者用
27
- 180
USD
締め切り
最低 1 最高 31 日
依頼者
出された注文1
裁定取引数0