Spezifikation
//+------------------------------------------------------------------+
//| XAUUSD Automated Forex Robot |
//| Enhanced Version with Error Handling and Improvements |
//+------------------------------------------------------------------+
input int FastMA = 10; // Fast moving average period
input int SlowMA = 50; // Slow moving average period
input int RSI_Period = 14; // RSI period
input double Overbought = 70; // RSI overbought level
input double Oversold = 30; // RSI oversold level
input double RiskPercent = 1.0; // Risk per trade as a percentage of account equity
input double ATRMultiplier = 2.0; // ATR multiplier for stop-loss
input double TrailingStop = 300; // Trailing stop in points
input double MinLotSize = 0.01; // Minimum lot size
input double LotStep = 0.01; // Lot size increment
input int ATR_Period = 14; // ATR period
input int MaxSlippage = 3; // Maximum slippage in points
input int MAGIC_NUMBER = 123456; // Unique identifier for trades
input string TradeComment = "XAUUSD Bot"; // Trade comment
//+------------------------------------------------------------------+
//| OnTick Function - Main Logic |
//+------------------------------------------------------------------+
void OnTick() {
// Calculate indicators
static double fastMA, slowMA, rsi, atr;
fastMA = iMA(NULL, 0, FastMA, 0, MODE_EMA, PRICE_CLOSE, 0);
slowMA = iMA(NULL, 0, SlowMA, 0, MODE_EMA, PRICE_CLOSE, 0);
rsi = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, 0);
atr = iATR(NULL, 0, ATR_Period, 0);
// Check for existing trades
bool buyOpen = IsTradeOpen(OP_BUY);
bool sellOpen = IsTradeOpen(OP_SELL);
// Entry logic
if (fastMA > slowMA && rsi > Oversold && rsi < 50 && !buyOpen) {
// Buy Signal
double sl = Bid - ATRMultiplier * atr;
double tp = Bid + ATRMultiplier * atr * 2;
double lotSize = CalculateLotSize(sl);
OpenTrade(OP_BUY, lotSize, sl, tp);
}
if (fastMA < slowMA && rsi < Overbought && rsi > 50 && !sellOpen) {
// Sell Signal
double sl = Ask + ATRMultiplier * atr;
double tp = Ask - ATRMultiplier * atr * 2;
double lotSize = CalculateLotSize(sl);
OpenTrade(OP_SELL, lotSize, sl, tp);
}
// Exit logic (Close trades when conditions reverse)
if (buyOpen && (fastMA < slowMA || rsi >= Overbought)) {
CloseTrade(OP_BUY);
}
if (sellOpen && (fastMA > slowMA || rsi <= Oversold)) {
CloseTrade(OP_SELL);
}
// Manage Trailing Stop
ManageTrailingStop();
}
//+------------------------------------------------------------------+
//| Calculate Lot Size Based on Risk |
//+------------------------------------------------------------------+
double CalculateLotSize(double stopLossPrice) {
double accountEquity = AccountEquity();
double riskAmount = (RiskPercent / 100) * accountEquity;
double stopLossDistance = MathAbs(Bid - stopLossPrice);
double lotSize = riskAmount / (stopLossDistance * MarketInfo(Symbol(), MODE_TICKVALUE));
// Adjust lot size to broker limits
lotSize = MathMax(lotSize, MinLotSize);
lotSize = NormalizeDouble(MathFloor(lotSize / LotStep) * LotStep, 2);
return lotSize;
}
//+------------------------------------------------------------------+
//| Open Trade Function |
//+------------------------------------------------------------------+
void OpenTrade(int tradeType, double lotSize, double stopLoss, double takeProfit) {
double price = tradeType == OP_BUY ? Ask : Bid;
int ticket = OrderSend(Symbol(), tradeType, lotSize, price, MaxSlippage, stopLoss, takeProfit, TradeComment, MAGIC_NUMBER, 0, Blue);
if (ticket < 0) {
int errorCode = GetLastError();
Print("Error opening trade: ", errorCode, ". Retrying...");
Sleep(1000); // Retry after 1 second
ticket = OrderSend(Symbol(), tradeType, lotSize, price, MaxSlippage, stopLoss, takeProfit, TradeComment, MAGIC_NUMBER, 0, Blue);
if (ticket < 0) {
Print("Failed to open trade after retry. Error: ", GetLastError());
}
} else {
Print("Trade opened: ", ticket);
}
}
//+------------------------------------------------------------------+
//| Close Trade Function |
//+------------------------------------------------------------------+
void CloseTrade(int tradeType) {
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() == tradeType && OrderMagicNumber() == MAGIC_NUMBER) {
int ticket = OrderClose(OrderTicket(), OrderLots(), tradeType == OP_BUY ? Bid : Ask, MaxSlippage, Red);
if (ticket < 0) {
Print("Error closing trade: ", GetLastError());
} else {
Print("Trade closed: ", ticket);
}
}
}
}
}
//+------------------------------------------------------------------+
//| Manage Trailing Stop Function |
//+------------------------------------------------------------------+
void ManageTrailingStop() {
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC_NUMBER) {
double newStopLoss;
if (OrderType() == OP_BUY) {
newStopLoss = Bid - TrailingStop * Point;
if (newStopLoss > OrderStopLoss()) {
OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, Blue);
}
} else if (OrderType() == OP_SELL) {
newStopLoss = Ask + TrailingStop * Point;
if (newStopLoss < OrderStopLoss()) {
OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, Blue);
}
}
}
}
}
}
//+------------------------------------------------------------------+
//| Check if Trade Exists |
//+------------------------------------------------------------------+
bool IsTradeOpen(int tradeType) {
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() == tradeType && OrderMagicNumber() == MAGIC_NUMBER) {
return true;
}
}
}
return false;
}
Bewerbungen
1
Bewertung
Projekte
188
57%
Schlichtung
10
80%
/
0%
Frist nicht eingehalten
0
Frei
Veröffentlicht: 1 Beispiel
2
Bewertung
Projekte
301
28%
Schlichtung
33
24%
/
61%
Frist nicht eingehalten
9
3%
Arbeitet
3
Bewertung
Projekte
38
21%
Schlichtung
5
0%
/
60%
Frist nicht eingehalten
0
Frei
4
Bewertung
Projekte
499
19%
Schlichtung
33
42%
/
30%
Frist nicht eingehalten
32
6%
Beschäftigt
5
Bewertung
Projekte
20
10%
Schlichtung
4
50%
/
50%
Frist nicht eingehalten
5
25%
Frei
6
Bewertung
Projekte
622
54%
Schlichtung
29
55%
/
24%
Frist nicht eingehalten
6
1%
Beschäftigt
7
Bewertung
Projekte
8
13%
Schlichtung
3
0%
/
33%
Frist nicht eingehalten
2
25%
Frei
Veröffentlicht: 1 Beispiel
8
Bewertung
Projekte
13
23%
Schlichtung
7
0%
/
71%
Frist nicht eingehalten
3
23%
Arbeitet
9
Bewertung
Projekte
105
60%
Schlichtung
0
Frist nicht eingehalten
0
Frei
10
Bewertung
Projekte
6
17%
Schlichtung
0
Frist nicht eingehalten
3
50%
Frei
11
Bewertung
Projekte
2
0%
Schlichtung
5
0%
/
80%
Frist nicht eingehalten
1
50%
Frei
12
Bewertung
Projekte
134
66%
Schlichtung
36
25%
/
56%
Frist nicht eingehalten
22
16%
Frei
Veröffentlicht: 10 Beispiele
13
Bewertung
Projekte
483
75%
Schlichtung
5
80%
/
0%
Frist nicht eingehalten
0
Arbeitet
14
Bewertung
Projekte
157
21%
Schlichtung
23
9%
/
78%
Frist nicht eingehalten
16
10%
Arbeitet
15
Bewertung
Projekte
619
33%
Schlichtung
36
36%
/
53%
Frist nicht eingehalten
11
2%
Beschäftigt
16
Bewertung
Projekte
1
0%
Schlichtung
1
0%
/
100%
Frist nicht eingehalten
0
Frei
17
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
Veröffentlicht: 1 Beispiel
18
Bewertung
Projekte
81
43%
Schlichtung
27
11%
/
70%
Frist nicht eingehalten
8
10%
Frei
19
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Arbeitet
Ähnliche Aufträge
can anyone help me with building a complete automated pine code strategy and indicator that work for both FXs & CFDs and have a high winning rate proved through back testing. I have a very complex current code that developed mostly using AI but lots of gaps are there although it translate exactly what I have in my mind. So, you are free to decide whether wo build a complete new code or fix my current working code ( i
Custom Indicator Conversion to Ea
500 - 1000 USD
Hello, I’m looking for an experienced MT4 (MQL4) developer to convert the Lucky Reversal indicator from indicatorspot.com into a fully functional Expert Advisor (EA). Project Scope Code an MT4 EA that replicates the exact logic and signals of the Lucky Reversal indicator Trades should open and close automatically based on the indicator’s rules Must match indicator behavior 1:1 (no approximations) EA Requirements MT4
This is a request for a formal price quote only. No work should begin until the quote is accepted. I am requesting a quantitative audit of an existing trading strategy. Scope (strict): 10-year historical backtest Full performance metrics (expectancy, win rate, profit factor, max drawdown, trade distribution) Identification of logical flaws, bias, and overfitting Rule-based corrections only if justified by data
I am looking for a senior MQL5 developer to build a custom MT5 Expert Advisor using a dual-engine grid structure (BUY + SELL operating independently). The EA will be used in a real operating business with live clients, so the implementation must be clean, deterministic and reliable. I already have a complete specification describing all the required logic (entry rules, grid logic, basket TP, break-even behavior
I would like to request the development of an Expert Advisor (EA) for MetaTrader 5 with the following specifications: 1. Instruments: NASDAQ (US100) Dow Jones (US30) DAX (DE40) 2. Opening Range Selection: The EA should allow me to manually select a specific time range on the chart. Example: US100 opening range from 14:30 UTC to 14:45 UTC (15-minute opening range for the US market). The EA should automatically
Editing an MQL4 file
30+ USD
Hello, I have the code for an indicator file that works with binary options. I want to make a simple modification to it that won't take much effort for professionals. In short, the modification I want is that if the strategy's conditions are met, a buy or sell signal should appear at 17:55. The strategy works exclusively on the 5-minute timeframe, and I want to delay the signal by 7 minutes so that it appears and
开发用于XAUUSD的MT5智能交易系统(EA):基于6指标共振的多层过滤反转策略
31 - 2000 USD
描述(项目概述): 我需要为 MetaTrader 5 平台开发一个功能完整的智能交易系统( 专家顾问 ),用于交易 XAUUSD (伦敦金)。该 艺电 的核心是基于一份详细的技术规格书,实现一个多指标共振、多层条件过滤的短线反转策略。 1. 核心策略逻辑简述: 交易品种与周期:主交易周期为 M30 ,需在代码内部动态读取 H4 周期进行趋势过滤,并监控 M5 周期以执行复杂的出场逻辑。 入场机制:采用 “ 价格触发 -> 成交量确认 -> 多指标渐进式达标 ” 的严格流程。入场信号需在特定时间窗口内,同时满足布林带突破及 5 个动量指标( CCI、RSI、MFI, 威廉指标, 随机指标)的超买 / 超卖条件,并受 H4 级别趋势过滤器约束。 出场机制:采用三层递进逻辑,包括动态保本移动、 M5 周期指标集体反转信号以及基于 K 线形态的趋势反转终极止损。
Looking for existing EA
30 - 95 USD
SMC, etc.) - Backtest results and the set files you used - Whether you’re willing to make minor tweaks so I can use it as my own If the performance looks good, we can discuss adjustments and next steps. My requirements are screenshot, backtes results, demo fileS Let me know if you have anything that fits the bill
iF you already have an successful MT4 EA for scalping in M5 XAUUSD [and eventually EURUSD and USDJPY] working essentially ON the trend when there is an Break Of Structure but also on reversal eventually with strategy Martingale with param ON/OFF eventually with strategy Grid with param ON/OFF eventually with HEDGING with param ON/OFF and on each trade : Stop loss, Trailing sl without High Frequency Trades [means
I need high risk high reward ea
30 - 200 USD
"I'm searching for a genuinely aggressive, high-risk / ultra-high-reward Expert Advisor (EA) optimized for MetaTrader 5 , capable of running on a very small real account of $100 (or cent/micro account equivalent). Key requirements: Strategy type : Preferably martingale , grid + martingale hybrid , aggressive scalping with recovery , or any other explosive growth-oriented approach (Bollinger/martingale, hedging grid
Projektdetails
Budget
100+ USD