Spécifications
//+------------------------------------------------------------------+
//| 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;
}
Répondu
1
Évaluation
Projets
188
57%
Arbitrage
10
80%
/
0%
En retard
0
Gratuit
Publié : 1 code
2
Évaluation
Projets
301
28%
Arbitrage
33
24%
/
61%
En retard
9
3%
Travail
3
Évaluation
Projets
38
21%
Arbitrage
5
0%
/
60%
En retard
0
Gratuit
4
Évaluation
Projets
499
19%
Arbitrage
33
42%
/
30%
En retard
32
6%
Chargé
5
Évaluation
Projets
20
10%
Arbitrage
4
50%
/
50%
En retard
5
25%
Gratuit
6
Évaluation
Projets
622
54%
Arbitrage
29
55%
/
24%
En retard
6
1%
Chargé
7
Évaluation
Projets
8
13%
Arbitrage
3
0%
/
33%
En retard
2
25%
Gratuit
Publié : 1 code
8
Évaluation
Projets
13
23%
Arbitrage
7
0%
/
71%
En retard
3
23%
Travail
9
Évaluation
Projets
105
60%
Arbitrage
0
En retard
0
Gratuit
10
Évaluation
Projets
6
17%
Arbitrage
0
En retard
3
50%
Gratuit
11
Évaluation
Projets
2
0%
Arbitrage
5
0%
/
80%
En retard
1
50%
Gratuit
12
Évaluation
Projets
134
66%
Arbitrage
36
25%
/
56%
En retard
22
16%
Gratuit
Publié : 10 codes
13
Évaluation
Projets
483
75%
Arbitrage
5
80%
/
0%
En retard
0
Travail
14
Évaluation
Projets
157
21%
Arbitrage
23
9%
/
78%
En retard
16
10%
Travail
15
Évaluation
Projets
619
33%
Arbitrage
36
36%
/
53%
En retard
11
2%
Chargé
16
Évaluation
Projets
1
0%
Arbitrage
1
0%
/
100%
En retard
0
Gratuit
17
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Publié : 1 code
18
Évaluation
Projets
81
43%
Arbitrage
27
11%
/
70%
En retard
8
10%
Gratuit
19
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Travail
Commandes similaires
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
looking for EA using zone recovery strategy. would like to make small per cent daily with small drawdown. it is a martingale hedge system. Please make the entry based on your own judgement
I need trading bot for signal
40 - 50 USD
Hi, is this signal enough for a bot to trade on attached images. its literally just a telegram channel I have access to, the trader avg's 10% weekly for the last 2 years, but I do not have the time to copy trade so wanted to find a solution, all he does is send TV screenshots of his entry/sl/tp and then sends updates as he manages the trade. I thought about hiring someone in a similar timezone to the trader (hes in
Modifiedea
30+ USD
Please my robot doesn’t open trades and I also believe it the ma crossover and others please I want the ma crossover to be fixed.also add trade directions to parameter for both, only sell, or only buys. Please also correct the balance drawdown and equity drawdown if it’s not working.the ea would be carefully tested for assessment l. Also source code will be handed before Payment. Only 30bucks for budget
I need an MT4/MT5 EA modification. Requirements: 1. Equity protection based on DAILY and TOTAL drawdown 2. Automatically close all trades when limit is hit 3. Disable trading after drawdown hit 4. Email notification when: - Daily loss limit reached - Total loss limit reached 5. EA must work on multiple accounts simultaneously 6. Clean and error-free code 7. Compatible with MT5 (or MT4 mention yours)
Profitable MT5 bot on XAUUSD
70+ USD
If you have profitable strategy or profitable EA on the gold pair without martingale / Hedge, then share me the EA with expiry time to back test and to test on the live market. Platform: MT5 pair: Gold Non-Martingale, No Hedging. Need Source Code
I have a working Python backtester for my “DC-WAD Donchian” strategy. I need a MetaTrader 5 Expert Advisor (MQL5) for live trading that matches the Python logic as closely as possible ( no lookahead ). ✅ Critical requirement (must accept) EA must be tick-driven for entries/exits (touch logic). Bar-close approximation is not acceptable . Timeframes Strategy runs on a single Setup Timeframe (HTF) (user input, e.g
EA-Halftrend-STRICT FILTER
50+ USD
This indicator will code into MT5 EA. Trade on live, demo and strategy tester. No repaint, no redraw and stable on chart. 1. Include all inputs variable and value, Lots size in points adjustable, TP in points true or false adjustable, SL in points true or false adjustable, close position on opposite signal true or false, Use pending order true or false, use BE points true or false, use slippage point true or false
Good day, I am searching the very high level expert, which could create the auto-trade robot and I would like to order the trading robot for GOLD XAU/USD auto-trade on MetaTrader. I could pay a lot for the institutional grade auto-trade robot, just contact me and let me know what level of the robot you could offer and we will negotiate the price
Looking to purchase a EA for Gold and US30 with source Requirements: must have proper built in Risk Management Must yield good profit factor and recovery Factor Must work on any Broker Must have less than 15% drawdown Year over Year Z-Score should be high Consecutive Profits Must Outweigh Consecutive losses atleast 3/1 Must be able to work on accounts from 100USD and up Testing must be based off of real Tick Values
Informations sur le projet
Budget
100+ USD