Termos de Referência
//+------------------------------------------------------------------+
//| 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();
}
Respondido
1
Classificação
Projetos
660
32%
Arbitragem
43
44%
/
44%
Expirado
11
2%
Carregado
2
Classificação
Projetos
319
29%
Arbitragem
34
26%
/
65%
Expirado
10
3%
Livre
3
Classificação
Projetos
7
0%
Arbitragem
2
50%
/
0%
Expirado
1
14%
Trabalhando
4
Classificação
Projetos
173
25%
Arbitragem
23
9%
/
78%
Expirado
16
9%
Trabalhando
5
Classificação
Projetos
9
11%
Arbitragem
0
Expirado
0
Livre
6
Classificação
Projetos
159
43%
Arbitragem
3
33%
/
33%
Expirado
1
1%
Carregado
7
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
8
Classificação
Projetos
2
0%
Arbitragem
0
Expirado
0
Livre
9
Classificação
Projetos
33
24%
Arbitragem
3
33%
/
33%
Expirado
4
12%
Trabalhando
10
Classificação
Projetos
288
35%
Arbitragem
18
22%
/
61%
Expirado
42
15%
Trabalhando
11
Classificação
Projetos
89
28%
Arbitragem
24
13%
/
58%
Expirado
7
8%
Trabalhando
12
Classificação
Projetos
19
26%
Arbitragem
0
Expirado
3
16%
Livre
13
Classificação
Projetos
20
0%
Arbitragem
10
0%
/
80%
Expirado
6
30%
Livre
14
Classificação
Projetos
559
35%
Arbitragem
80
31%
/
44%
Expirado
203
36%
Livre
15
Classificação
Projetos
125
24%
Arbitragem
23
26%
/
52%
Expirado
8
6%
Trabalhando
16
Classificação
Projetos
5
0%
Arbitragem
3
33%
/
67%
Expirado
2
40%
Livre
17
Classificação
Projetos
169
38%
Arbitragem
9
78%
/
22%
Expirado
15
9%
Livre
18
Classificação
Projetos
373
72%
Arbitragem
19
32%
/
47%
Expirado
14
4%
Livre
Publicou: 14 códigos
19
Classificação
Projetos
20
40%
Arbitragem
1
0%
/
100%
Expirado
1
5%
Livre
20
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
21
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
22
Classificação
Projetos
490
23%
Arbitragem
60
53%
/
25%
Expirado
56
11%
Carregado
23
Classificação
Projetos
31
55%
Arbitragem
3
33%
/
33%
Expirado
0
Trabalhando
24
Classificação
Projetos
435
54%
Arbitragem
20
55%
/
15%
Expirado
30
7%
Trabalhando
25
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
26
Classificação
Projetos
26
27%
Arbitragem
0
Expirado
2
8%
Livre
27
Classificação
Projetos
3380
68%
Arbitragem
77
48%
/
14%
Expirado
342
10%
Livre
Publicou: 1 código
28
Classificação
Projetos
1
100%
Arbitragem
0
Expirado
0
Livre
29
Classificação
Projetos
285
41%
Arbitragem
15
13%
/
47%
Expirado
67
24%
Livre
30
Classificação
Projetos
9
0%
Arbitragem
2
0%
/
50%
Expirado
1
11%
Trabalhando
31
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
32
Classificação
Projetos
477
40%
Arbitragem
105
40%
/
24%
Expirado
81
17%
Carregado
Publicou: 2 códigos
33
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
34
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
35
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
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
MT5 Manager API
30+ USD
make an api for mt5 and a trade copier eith the api thst uses local computer no cloud trader api ea mt5 that saves all trade data nd logs time and entry and exit tp sl logs delted pending order api that uses market execution not pending orfer
API our EA into an AI agent or perplexity
100 - 300 USD
Hello, we have an existing EA, and are building a new one. We want our EA to connect via API to an AI provider like Chat GPT, Claude, or perplexity. Can you connect a meta trader EA to an AI agent? if you can then i would like to speak. The system is quite simple, for example the EA would ask perplexity where the support is on EURUSD then place a trade, thank you, Rob
Hi, Im looking to purchase or build an EA that can open many trades or big lot size to churn out IB commission, it doesnt have to be super profitable but will need to have the number of trades on going in order to earn IB commission. Source code is required upon purchase. If you have any EA or strategy that are gearing towards this, let me know and i would be glad to purchase it. Please share the demo trial for me to
I currently have unfinished work. It’s a project to connect MetaTrader with the BingX platform. At the moment, I have implemented a service that retrieves a custom symbol in BingX, and it works well. However, some specifications still need to be adjusted regarding how the data is received. Otherwise, prices and other values are accurate. The only issue is that for the strategy tester, it is always necessary to
Modify an existing EA
30 - 50 USD
This is to modify my Semi Auto EA -Looking for developer modify my existing EA to Pending Order EA (BS/BL/SL/SS). Relevent with Heiken Ashi Smooth ,Moving Average , Acceleration. Concept MAster and Slave. Ready to give previous soucre code as guide. Work to do - 1)To modify this EA to Pending Order. 2) to add new feature - Risk Management/moneymanagement 3) To modify 4 slave to 7 slave will give the previous to
BTC 5 Minutes scalping
50 - 100 USD
import { useState, useEffect, useRef } from "react"; const INIT_LOT = 0.01; const TP_MOVE = 200; const SL_MOVE = 120; const START_BALANCE = 1000; const MAX_LOT = 5.12; const TICK_MS = 1200; function ema(arr, n) { if (arr.length < n) return null; const k = 2 / (n + 1); let e = arr.slice(0, n).reduce((s, v) => s + v, 0) / n; for (let i = n; i < arr.length; i++) e = arr[i] * k + e * (1 - k); return e; } function
Informações sobre o projeto
Orçamento
30 - 200 USD
IVA (20%):
6
-
40
USD
Total:
36
-
240
USD
Desenvolvedor
27
- 180
USD
Prazo
de 1 para 31 dias
Cliente
Pedidos postados1
Número de arbitragens0