Spezifikation
kguyfytd hdgytif ftiloyesytfjkg fugugy //+------------------------------------------------------------------+
//| Gold_Grid_EA_v5.mq5 |
//| Grid Bot – XAUUSD – AHMAD BARGHOUTH |
//| v5: Trailing 50 نقطة ثابتة يلحق السعر + نجوم كلمة السر |
//+------------------------------------------------------------------+
#property copyright "AHMAD BARGHOUTH"
#property version "5.00"
#property strict
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
CTrade trade;
CPositionInfo posInfo;
//--- Inputs
input string InpPassword = ""; // كلمة السر (اكتبها هنا)
input double InpLotSize = 0.01;
input int InpGridPoints = 45; // نقاط بين الصفقات
input int InpStartOffset = 90; // نقاط بين أول BUY وأول SELL
input int InpBuyCount = 10;
input int InpSellCount = 10;
// TP = سعر الصفقة الخامسة = 4 × GridPoints (يُحسب تلقائياً)
input int InpSLPoints = 2000; // Stop Loss احتياطي
input int InpTrailingPoints = 50; // مسافة Trailing بالنقاط (ثابتة)
input int InpTrailingStep = 10; // خطوة تحريك SL (نقاط) — يمنع التعديل على كل تيك
input int InpMaxStopLosses = 3; // عدد الستوبات قبل الريست
input int InpStartHour = 9;
input int InpEndHour = 20;
input double InpMaxDailyLoss = 500.0;
input ulong InpMagicNumber = 303030;
input bool InpCloseAll = false;
//--- Globals
double point;
int digits;
bool isUnlocked = false;
bool gridOpened = false;
double dayStartBalance = 0;
datetime lastDay = 0;
int stopLossCount = 0;
int totalPositions = 0;
datetime lastResetTime = 0;
//--- Object Names
#define OBJ_BG "AB_Background"
#define OBJ_GOLD1 "AB_GoldBar1"
#define OBJ_GOLD2 "AB_GoldBar2"
#define OBJ_TITLE "AB_Title"
#define OBJ_NAME "AB_Name"
#define OBJ_LOCK "AB_LockIcon"
#define OBJ_MSG "AB_Message"
#define OBJ_WATERMARK "AB_Watermark"
#define OBJ_STATUS "AB_Status"
#define OBJ_STATUS2 "AB_Status2"
#define OBJ_DIVIDER "AB_Divider"
//+------------------------------------------------------------------+
//| TP يساوي سعر الصفقة الخامسة = 4 × GridPoints |
//+------------------------------------------------------------------+
double CalcTPPoints()
{
return InpGridPoints * 4.0;
}
//+------------------------------------------------------------------+
int OnInit()
{
if(StringFind(_Symbol, "XAU") < 0 && _Symbol != "GOLD")
{
Alert("البوت مخصص للذهب فقط! الرمز: ", _Symbol);
return INIT_FAILED;
}
trade.SetExpertMagicNumber(InpMagicNumber);
trade.SetDeviationInPoints(50);
trade.SetTypeFilling(ORDER_FILLING_RETURN);
point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
digits = (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS);
dayStartBalance = AccountInfoDouble(ACCOUNT_BALANCE);
lastDay = TimeCurrent();
DrawLoginScreen();
if(InpPassword == "k2ahmadk2@AA")
{
isUnlocked = true;
DrawUnlockedScreen();
if(InpCloseAll)
{
CloseAll();
ExpertRemove();
return INIT_SUCCEEDED;
}
if(CountPositions() == 0 && CountOrders() == 0)
OpenGrid();
else
{
totalPositions = CountPositions();
gridOpened = true;
Print("صفقات مسبقة موجودة: ", totalPositions);
}
}
else if(InpPassword != "")
{
DrawWrongPassword();
Print("❌ كلمة السر خاطئة!");
}
else
{
Print("⏳ في انتظار كلمة السر...");
}
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
void OnTick()
{
if(!isUnlocked) return;
if(!CheckDailyLoss()) return;
MqlDateTime dt;
TimeToStruct(TimeCurrent(), dt);
if(dt.hour < InpStartHour || dt.hour >= InpEndHour) return;
CheckStopLossReset();
// Trailing يشتغل على كل صفقة مفتوحة فوراً من أول تيك
TrailingStop();
UpdateStatus();
}
//+------------------------------------------------------------------+
//| فحص الستوبات وإعادة فتح الشبكة |
//+------------------------------------------------------------------+
void CheckStopLossReset()
{
int currentPositions = CountPositions();
if(gridOpened && currentPositions < totalPositions && totalPositions > 0)
{
int closedNow = totalPositions - currentPositions;
stopLossCount += closedNow;
Print("⚠️ صفقة أُغلقت! عداد: ", stopLossCount, "/", InpMaxStopLosses);
totalPositions = currentPositions;
if(stopLossCount >= InpMaxStopLosses)
{
if(TimeCurrent() - lastResetTime < 5) return;
Print("🔄 ", InpMaxStopLosses, " ستوبات → إعادة فتح الشبكة...");
CloseAll();
stopLossCount = 0;
totalPositions = 0;
gridOpened = false;
lastResetTime = TimeCurrent();
OpenGrid();
Print("✅ تمت إعادة فتح الشبكة");
}
}
if(gridOpened && totalPositions == 0 && currentPositions > 0)
totalPositions = currentPositions;
}
//+------------------------------------------------------------------+
//| Trailing Stop ثابت 50 نقطة — يلحق السعر من أول تيك |
//| BUY → SL يلحق من تحت السعر بـ 50 نقطة (يطلع مع السعر) |
//| SELL → SL يلحق من فوق السعر بـ 50 نقطة (ينزل مع السعر) |
//+------------------------------------------------------------------+
void TrailingStop()
{
// مسافة الـ Trailing بالسعر
double trailing = InpTrailingPoints * point;
// أقل خطوة تحريك للـ SL (نمنع التعديل المستمر على كل تيك)
double step = InpTrailingStep * point;
for(int i = 0; i < PositionsTotal(); i++)
{
if(!posInfo.SelectByIndex(i)) continue;
if(posInfo.Magic() != InpMagicNumber) continue;
if(posInfo.Symbol() != _Symbol) continue;
double currentSL = posInfo.StopLoss();
double currentTP = posInfo.TakeProfit();
if(posInfo.PositionType() == POSITION_TYPE_BUY)
{
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
// SL الجديد = السعر الحالي - 50 نقطة (يلحق السعر للأعلى)
double newSL = NormalizeDouble(bid - trailing, digits);
// يتحرك فقط لو SL الجديد أعلى من القديم بمقدار الخطوة
if(newSL > 0 && (currentSL < 1.0 || newSL >= currentSL + step))
{
if(trade.PositionModify(posInfo.Ticket(), newSL, currentTP))
Print("📈 BUY Trailing #", posInfo.Ticket(),
" | BID=", DoubleToString(bid, digits),
" | SL → ", DoubleToString(newSL, digits));
}
}
else if(posInfo.PositionType() == POSITION_TYPE_SELL)
{
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
// SL الجديد = السعر الحالي + 50 نقطة (يلحق السعر للأسفل)
double newSL = NormalizeDouble(ask + trailing, digits);
// يتحرك فقط لو SL الجديد أقل من القديم بمقدار الخطوة
if(newSL > 0 && (currentSL < 1.0 || newSL <= currentSL - step))
{
if(trade.PositionModify(posInfo.Ticket(), newSL, currentTP))
Print("📉 SELL Trailing #", posInfo.Ticket(),
" | ASK=", DoubleToString(ask, digits),
" | SL → ", DoubleToString(newSL, digits));
}
}
}
}
//+------------------------------------------------------------------+
//| فتح الشبكة |
//| TP = سعر الصفقة الخامسة (4 × GridPoints) |
//+------------------------------------------------------------------+
void OpenGrid()
{
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
double gap = InpGridPoints * point;
double offset = InpStartOffset * point;
double sl_pts = InpSLPoints * point;
// TP = 4 فراغات شبكة = مسافة من صفقة 1 لصفقة 5
double tpPts = CalcTPPoints() * point;
int buyOK = 0, sellOK = 0;
for(int i = 0; i < InpBuyCount; i++)
{
double entry = NormalizeDouble(ask + offset + i * gap, digits);
double tp = NormalizeDouble(entry + tpPts, digits);
double sl = NormalizeDouble(entry - sl_pts, digits);
if(trade.BuyStop(InpLotSize, entry, _Symbol, sl, tp,
ORDER_TIME_GTC, 0, "GGRID_BUY_" + IntegerToString(i + 1)))
buyOK++;
}
for(int i = 0; i < InpSellCount; i++)
{
double entry = NormalizeDouble(bid - offset - i * gap, digits);
double tp = NormalizeDouble(entry - tpPts, digits);
double sl = NormalizeDouble(entry + sl_pts, digits);
if(trade.SellStop(InpLotSize, entry, _Symbol, sl, tp,
ORDER_TIME_GTC, 0, "GGRID_SELL_" + IntegerToString(i + 1)))
sellOK++;
}
gridOpened = true;
totalPositions = 0;
Print("✅ الشبكة جاهزة | BUY: ", buyOK, " | SELL: ", sellOK,
" | TP=", DoubleToString(tpPts / point, 0), " نقطة (صفقة 5)",
" | Trailing=", InpTrailingPoints, " نقطة",
" | Grid=", InpGridPoints, " | Offset=", InpStartOffset);
}
//+------------------------------------------------------------------+
void UpdateStatus()
{
static datetime lastUpdate = 0;
if(TimeCurrent() - lastUpdate < 5) return;
lastUpdate = TimeCurrent();
string statusText = StringFormat(
"🟢 EA Active | Positions: %d | SL Count: %d/%d | Trailing: %d pts | TP: %d pts",
CountPositions(), stopLossCount, InpMaxStopLosses,
InpTrailingPoints, (int)CalcTPPoints()
);
ObjectSetString(0, OBJ_STATUS, OBJPROP_TEXT, statusText);
ChartRedraw(0);
}
//+------------------------------------------------------------------+
bool CheckDailyLoss()
{
MqlDateTime now, last;
TimeToStruct(TimeCurrent(), now);
TimeToStruct(lastDay, last);
if(now.day != last.day)
{
dayStartBalance = AccountInfoDouble(ACCOUNT_BALANCE);
lastDay = TimeCurrent();
stopLossCount = 0;
Print("📅 يوم جديد - تم إعادة ضبط العداد");
}
double currentBalance = AccountInfoDouble(ACCOUNT_BALANCE);
double dailyLoss = dayStartBalance - currentBalance;
if(dailyLoss >= InpMaxDailyLoss)
{
Print("🛑 الحد اليومي للخسارة: $", DoubleToString(dailyLoss, 2));
ObjectSetString (0, OBJ_STATUS, OBJPROP_TEXT,
"🔴 STOPPED | Daily Loss: $" + DoubleToString(dailyLoss, 2));
ObjectSetInteger(0, OBJ_STATUS, OBJPROP_COLOR, clrRed);
ChartRedraw(0);
CloseAll();
return false;
}
return true;
}
//+------------------------------------------------------------------+
//| شاشة Login مع نجوم كلمة السر على الشاشة |
//+------------------------------------------------------------------+
void DrawLoginScreen()
{
int chartW = (int)ChartGetInteger(0, CHART_WIDTH_IN_PIXELS);
int chartH = (int)ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS);
// خلفية
ObjectCreate(0, OBJ_BG, OBJ_RECTANGLE_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_BG, OBJPROP_XDISTANCE, 0);
ObjectSetInteger(0, OBJ_BG, OBJPROP_YDISTANCE, 0);
ObjectSetInteger(0, OBJ_BG, OBJPROP_XSIZE, chartW);
ObjectSetInteger(0, OBJ_BG, OBJPROP_YSIZE, chartH);
ObjectSetInteger(0, OBJ_BG, OBJPROP_BGCOLOR, C'10,10,20');
ObjectSetInteger(0, OBJ_BG, OBJPROP_BORDER_TYPE, BORDER_FLAT);
ObjectSetInteger(0, OBJ_BG, OBJPROP_COLOR, C'10,10,20');
ObjectSetInteger(0, OBJ_BG, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_BG, OBJPROP_ZORDER, 0);
// شريط ذهبي علوي
ObjectCreate(0, OBJ_GOLD1, OBJ_RECTANGLE_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_XDISTANCE, 0);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_YDISTANCE, 0);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_XSIZE, chartW);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_YSIZE, 8);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_BGCOLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_BORDER_TYPE, BORDER_FLAT);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_COLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_GOLD1, OBJPROP_ZORDER, 1);
// شريط ذهبي سفلي
ObjectCreate(0, OBJ_GOLD2, OBJ_RECTANGLE_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_XDISTANCE, 0);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_YDISTANCE, chartH - 8);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_XSIZE, chartW);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_YSIZE, 8);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_BGCOLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_BORDER_TYPE, BORDER_FLAT);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_COLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_GOLD2, OBJPROP_ZORDER, 1);
// خط فاصل ذهبي
ObjectCreate(0, OBJ_DIVIDER, OBJ_RECTANGLE_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_XDISTANCE, chartW/2 - 150);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_YDISTANCE, chartH/2 - 10);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_XSIZE, 300);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_YSIZE, 2);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_BGCOLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_BORDER_TYPE, BORDER_FLAT);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_COLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_DIVIDER, OBJPROP_ZORDER, 1);
// أيقونة القفل
ObjectCreate(0, OBJ_LOCK, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_XDISTANCE, chartW/2);
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_YDISTANCE, chartH/2 - 120);
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_ANCHOR, ANCHOR_CENTER);
ObjectSetString (0, OBJ_LOCK, OBJPROP_TEXT, "🔐");
ObjectSetString (0, OBJ_LOCK, OBJPROP_FONT, "Arial");
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_FONTSIZE, 48);
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_COLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_LOCK, OBJPROP_ZORDER, 2);
// عنوان البوت
ObjectCreate(0, OBJ_TITLE, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_XDISTANCE, chartW/2);
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_YDISTANCE, chartH/2 - 50);
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_ANCHOR, ANCHOR_CENTER);
ObjectSetString (0, OBJ_TITLE, OBJPROP_TEXT, "⬛ GOLD GRID EA v5.0 ⬛");
ObjectSetString (0, OBJ_TITLE, OBJPROP_FONT, "Arial Bold");
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_FONTSIZE, 22);
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_COLOR, C'212,175,55');
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_TITLE, OBJPROP_ZORDER, 2);
// الاسم
ObjectCreate(0, OBJ_NAME, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_XDISTANCE, chartW/2);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_YDISTANCE, chartH/2 + 20);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_ANCHOR, ANCHOR_CENTER);
ObjectSetString (0, OBJ_NAME, OBJPROP_TEXT, "✦ AHMAD BARGHOUTH ✦");
ObjectSetString (0, OBJ_NAME, OBJPROP_FONT, "Arial Bold");
ObjectSetInteger(0, OBJ_NAME, OBJPROP_FONTSIZE, 18);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_COLOR, clrWhite);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_BACK, false);
ObjectSetInteger(0, OBJ_NAME, OBJPROP_ZORDER, 2);
//------------------------------------------------------------
// نجوم كلمة السر على الشاشة ●●●●● بدل الحروف
//------------------------------------------------------------
{
int n = 0;
for(int i = OrdersTotal() - 1; i >= 0; i--)
if(OrderGetTicket(i) &&
OrderGetInteger(ORDER_MAGIC) == (long)InpMagicNumber &&
OrderGetString(ORDER_SYMBOL) == _Symbol)
n++;
return n;
}
void CloseAll()
{
for(int i = PositionsTotal() - 1; i >= 0; i--)
{
if(!posInfo.SelectByIndex(i)) continue;
if(posInfo.Magic() != InpMagicNumber || posInfo.Symbol() != _Symbol) continue;
trade.PositionClose(posInfo.Ticket());
}
for(int i = OrdersTotal() - 1; i >= 0; i--)
{
ulong t = OrderGetTicket(i);
if(t &&
Bewerbungen
1
Bewertung
Projekte
88
31%
Schlichtung
9
11%
/
56%
Frist nicht eingehalten
4
5%
Arbeitet
2
Bewertung
Projekte
1
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
3
Bewertung
Projekte
830
62%
Schlichtung
33
27%
/
45%
Frist nicht eingehalten
23
3%
Frei
Veröffentlicht: 1 Beispiel
4
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
Ähnliche Aufträge
I’m looking for an experienced MT4 developer to create a custom indicator (or EA) with mobile push notifications based on the following strategy. Trend Filter (Daily Timeframe) Daily Close above 50 EMA = Bullish Bias Daily Close below 50 EMA = Bearish Bias Entry Timeframe (H1) RSI Settings RSI Period: 14 (default) Upper Level: 65 Lower Level: 35 Buy Signal Generate a BUY signal when: Daily bias is Bullish (Daily
Hello, I'm looking for EA or indicator that would help me reach at least 0.5 lot daily on XAUUSD pair. I trade with 30-35 spread on live standard account. 0.3 to 0.5 lot on XAUUSD is all i need per day, without losing too much money during week or month doing that. Every advice od product is welcome. tg @stellarcptadmin
Tradingview Script to EA
30+ USD
✅ MT4 EA Developer Checklist (For Your Ladder EA) 1️⃣ Indicator Integration EA reads signals from provided custom indicator (.ex4 or .mq4) Detects “Buy Next” / “Sell Next” signals on current candle Works with arrow-based or buffer-based signals 2️⃣ Next Candle Execution EA does not trade on the candle where the signal appears Orders placed only at first tick of the next candle Timeframes supported: M1, M5, M15
PROFITABLE AI BOTS FOR MT5 AND CTRADER
100 - 200 USD
Hello, i need expert developer that have been develop so many profitable AI bots that work for mt5 and ctrader autonomously if you know you can easily execute this requirement bid for it. NOTE:- YOU MUST COME WITH SAMPLE FOR THE 2 TRADING PLATFORM. While i take a look at your profile and reach out to you thanks
I am looking for an experienced MT4/MT5 developer to analyze my trading history and replicate the strategy in a new Expert Advisor (EA). The developer must have proven experience in reverse engineering strategies, analyzing trading data, and developing EAs across various trading methodologies. A deep understanding of XAUUDS and BTCUSD behavior, as well as chart analysis, is essential. Please note that we do not have
Ea.Mix
30+ USD
I am in need of a good scalping bot for gold or any currency pair. If you have one that is working, reach out. You must be able to provide a trial version so I can test the bot myself
In need of a scalping bot
30+ USD
I am in need of a good scalping bot for gold or any currency pair. If you have one that is working, reach out. You must be able to provide a trial version so I can test the bot myself
Trading View Indicator
50+ USD
i have built a indicator on trading view which is veryt good, its based on liquidity sweeps on stop losses. im looking for an someone with experience in trading and indicators that has worked on similar strategy indicators. it already wins lots of very good trades im looking to tighten up on uneccesary trades it may send to clean it up as i currently am testing it out running to signal channel and want it the best /
I am looking for an experienced MQL5 developer to create a custom indicator for MetaTrader 5. The project requirements and indicator logic will be shared privately with the selected candidate to protect the concept and implementation details. Requirements: Strong experience with MQL5 indicator development. Ability to create clean, efficient, and well-structured code. Experience with custom buffers, chart objects
Hello, I am looking to develop a commercial-grade Expert Advisor for MT5 specifically optimized for XAUUSD (Gold). The underlying logic should be an intelligent, trend-filtered cost-averaging grid system focused on capital preservation. The EA must include the following functional architecture: 1. Core Strategy Structure: - Must feature a multi-strategy logic entry module. I want to use a combination of 3-4 standard
Projektdetails
Budget
1000+ USD
Kunde
Veröffentlichte Aufträge1
Anzahl der Schlichtungen0