Gold_Breakout_Ultimate_EA.mq5

Tarea técnica

//+------------------------------------------------------------------+
//|                 Gold_Breakout_Ultimate_EA.mq5                    |
//|                   الإصدار النهائي - خالي من أيقونة               |
//+------------------------------------------------------------------+
#property copyright "Elite Trader"
#property version   "1.13"
#property strict

// تم حذف سطر #property icon عمداً لتجنب خطأ الملف المفقود

#include <Trade/Trade.mqh>

// ==================== إعدادات المدخلات ====================
input double InpRiskPercent = 1.5;          // نسبة المخاطرة من الرصيد (%)
input double InpFixedLots = 0.0;            // حجم عقد ثابت (0 = استخدام النسبة)
input int    InpBreakoutBars = 20;          // عدد الشموع لتحديد المنطقة
input double InpBufferPercent = 0.15;       // هامش التمويه (لتقليل الإشارات الخادعة)
input int    InpRSIPeriod = 14;             // فترة مؤشر RSI
input int    InpMAPeriod = 200;             // المتوسط المتحرك للاتجاه العام
input double InpATRFilter = 0.4;            // نسبة ATR للفلتر (0 = إلغاء)
input double InpTakeProfitRatio = 2.0;      // مضاعف وقف الخسارة للهدف الأول
input double InpPartialPercent = 50.0;      // نسبة الإغلاق الجزئي عند الهدف الأول (%)
input double InpTrailingATR = 1.8;          // تفعيل التريلنج بعد هذا المضاعف من ATR
input bool   InpUseTimeFilter = true;       // تفعيل فلتر تجنب أوقات الأخبار
input int    InpCooldownBars = 3;           // عدد الشموع للانتظار بعد الصفقة الخاسرة

// ==================== المتغيرات العامة ====================
double Resistance_Level, Support_Level;
double ATR_Value, MA_Value, RSI_Value;
datetime lastBarTime;
int ATR_Handle, RSI_Handle, MA_Handle;
bool isBuyCooldown = false, isSellCooldown = false;
int barsAfterLoss = 0;
double lastTradeResult = 0;
CTrade trade;

//+------------------------------------------------------------------+
//| دالة التهيئة                                                     |
//+------------------------------------------------------------------+
int OnInit()
{
   ATR_Handle = iATR(_Symbol, _Period, 14);
   RSI_Handle = iRSI(_Symbol, _Period, InpRSIPeriod, PRICE_CLOSE);
   MA_Handle = iMA(_Symbol, _Period, InpMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
   
   if(ATR_Handle == INVALID_HANDLE || RSI_Handle == INVALID_HANDLE || MA_Handle == INVALID_HANDLE)
   {
      Print("خطأ في تهيئة المؤشرات");
      return(INIT_FAILED);
   }
   
   lastBarTime = iTime(_Symbol, _Period, 0);
   Print("✅ روبوت الذهب جاهز على ", _Symbol);
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| دالة التحديث لكل شمعة جديدة                                     |
//+------------------------------------------------------------------+
void OnTick()
{
   if(lastBarTime == iTime(_Symbol, _Period, 0))
      return;
   lastBarTime = iTime(_Symbol, _Period, 0);

   UpdateIndicators();
   CalculateZones();
   DrawZones();
   ManageOpenPositions();
   CheckForEntry();
}

//+------------------------------------------------------------------+
//| تحديث قيم المؤشرات                                              |
//+------------------------------------------------------------------+
void UpdateIndicators()
{
   double atr_arr[1], rsi_arr[1], ma_arr[1];
   CopyBuffer(ATR_Handle, 0, 0, 1, atr_arr);
   CopyBuffer(RSI_Handle, 0, 0, 1, rsi_arr);
   CopyBuffer(MA_Handle, 0, 0, 1, ma_arr);
   ATR_Value = atr_arr[0];
   RSI_Value = rsi_arr[0];
   MA_Value = ma_arr[0];
   if(ATR_Value == 0) ATR_Value = 0.1; // حماية
}

//+------------------------------------------------------------------+
//| حساب مناطق الدعم والمقاومة                                      |
//+------------------------------------------------------------------+
void CalculateZones()
{
   int start = 1;
   double high = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, MODE_HIGH, InpBreakoutBars, start));
   double low  = iLow(_Symbol, _Period, iLowest(_Symbol, _Period, MODE_LOW, InpBreakoutBars, start));
   double buffer = (high - low) * (InpBufferPercent / 100);
   Resistance_Level = high + buffer;
   Support_Level = low - buffer;
}

//+------------------------------------------------------------------+
//| رسم الخطوط على الشارت                                            |
//+------------------------------------------------------------------+
void DrawZones()
{
   ObjectCreate(0, "UBS_Res", OBJ_HLINE, 0, 0, Resistance_Level);
   ObjectSetInteger(0, "UBS_Res", OBJPROP_COLOR, clrRed);
   ObjectCreate(0, "UBS_Supp", OBJ_HLINE, 0, 0, Support_Level);
   ObjectSetInteger(0, "UBS_Supp", OBJPROP_COLOR, clrGreen);
}

//+------------------------------------------------------------------+
//| منطق الدخول (مع فلاتر الخبرة والـ ATR)                          |
//+------------------------------------------------------------------+
void CheckForEntry()
{
   if(InpUseTimeFilter && IsNewsTime())
      return;

   double close_cur = iClose(_Symbol, _Period, 0);
   double close_prev = iClose(_Symbol, _Period, 1);
   double open_cur = iOpen(_Symbol, _Period, 0);

   if(InpATRFilter > 0)
   {
      double range = MathAbs(close_cur - open_cur);
      if(range < (ATR_Value * InpATRFilter)) return;
   }

   // شراء
   if(!isBuyCooldown && close_prev <= Resistance_Level && close_cur > Resistance_Level && RSI_Value > 50)
   {
      if(!IsPositionExist(POSITION_TYPE_BUY))
      {
         double sl = Support_Level - (ATR_Value * 0.5);
         double tp = close_cur + ( (close_cur - sl) * InpTakeProfitRatio );
         OpenOrder(ORDER_TYPE_BUY, sl, tp);
         Print("🟢 شراء عند الاختراق");
      }
   }

   // بيع
   if(!isSellCooldown && close_prev >= Support_Level && close_cur < Support_Level && RSI_Value < 50)
   {
      if(!IsPositionExist(POSITION_TYPE_SELL))
      {
         double sl = Resistance_Level + (ATR_Value * 0.5);
         double tp = close_cur - ( (sl - close_cur) * InpTakeProfitRatio );
         OpenOrder(ORDER_TYPE_SELL, sl, tp);
         Print("🔴 بيع عند الكسر");
      }
   }
}

//+------------------------------------------------------------------+
//| إدارة الصفقات (الإغلاق الجزئي والتريلنج)                       |
//+------------------------------------------------------------------+
void ManageOpenPositions()
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);
      if(PositionSelectByTicket(ticket))
      {
         if(PositionGetString(POSITION_SYMBOL) != _Symbol) continue;
         
         double openPrice = PositionGetDouble(POSITION_PRICE_OPEN);
         double currentSL = PositionGetDouble(POSITION_SL);
         double currentTP = PositionGetDouble(POSITION_TP);
         ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
         
         double distance = 0;
         if(type == POSITION_TYPE_BUY)
            distance = (SymbolInfoDouble(_Symbol, SYMBOL_BID) - openPrice) / ATR_Value;
         else
            distance = (openPrice - SymbolInfoDouble(_Symbol, SYMBOL_ASK)) / ATR_Value;
         
         // إغلاق جزئي عند الهدف الأول
         if(distance >= (InpTakeProfitRatio * 0.75) && currentTP == 0)
         {
            if(InpPartialPercent > 0)
            {
               double lots = PositionGetDouble(POSITION_VOLUME);
               double closeLots = lots * (InpPartialPercent / 100);
               if(closeLots > 0.01)
               {
                  trade.PositionClosePartial(ticket, NormalizeLots(closeLots));
               }
            }
            trade.PositionModify(ticket, openPrice, 0);
         }
         
         // تفعيل التريلنج
         if(distance >= InpTrailingATR)
         {
            double newSL = 0;
            if(type == POSITION_TYPE_BUY)
               newSL = SymbolInfoDouble(_Symbol, SYMBOL_BID) - (ATR_Value * 0.8);
            else
               newSL = SymbolInfoDouble(_Symbol, SYMBOL_ASK) + (ATR_Value * 0.8);
            
            if((type == POSITION_TYPE_BUY && newSL > currentSL) ||
               (type == POSITION_TYPE_SELL && newSL < currentSL))
            {
               trade.PositionModify(ticket, newSL, currentTP);
            }
         }
      }
   }
}

//+------------------------------------------------------------------+
//| تنفيذ الأمر                                                      |
//+------------------------------------------------------------------+
void OpenOrder(ENUM_ORDER_TYPE type, double sl_price, double tp_price)
{
   double lots = InpFixedLots;
   if(lots == 0)
   {
      double riskMoney = AccountInfoDouble(ACCOUNT_BALANCE) * (InpRiskPercent / 100);
      double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
      double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
      double price = (type == ORDER_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_ASK) : SymbolInfoDouble(_Symbol, SYMBOL_BID);
      double slPoints = MathAbs(sl_price - price) / _Point;
      double riskPerLot = slPoints * tickValue * (tickSize / _Point);
      if(riskPerLot > 0) lots = riskMoney / riskPerLot;
      lots = NormalizeLots(lots);
   }

   double price = (type == ORDER_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_ASK) : SymbolInfoDouble(_Symbol, SYMBOL_BID);
   trade.PositionOpen(_Symbol, type, lots, price, sl_price, tp_price, "Gold EA");
}

//+------------------------------------------------------------------+
//| دوال مساعدة                                                      |
//+------------------------------------------------------------------+
bool IsPositionExist(ENUM_POSITION_TYPE type)
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      if(PositionSelectByTicket(PositionGetTicket(i)))
         if(PositionGetString(POSITION_SYMBOL) == _Symbol && PositionGetInteger(POSITION_TYPE) == type)
            return true;
   }
   return false;
}

double NormalizeLots(double lots)
{
   double step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
   if(step == 0) step = 0.01;
   double normalized = MathRound(lots / step) * step;
   normalized = NormalizeDouble(normalized, 2);
   if(normalized < SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN)) normalized = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
   if(normalized > SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX)) normalized = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
   return normalized;
}

بول إز نيوزتايم()
{
   datetime now = TimeCurrent();
   MqlDateTime dt;
TimeToStruct (الآن، dt);
   // تجنب التداول من 13:30 إلى 15:30 بتوقيت السيرفر
إذا (dt.hour == 13 && dt.min >= 30) أعاد true;
إذا (dt.hour == 14) أعاد true;
إذا (dt.hour == 15 && dt.min < 30) أعد true;
العودة خاطئة؛
}

//+------------------------------------------------------------------+
//| دالة التدمير (تنظيف)                                            |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
إذا(ATR_Handle != INVALID_HANDLE) IndicatorRelease(ATR_Handle);
إذا(RSI_Handle != INVALID_HANDLE) IndicatorRelease(RSI_Handle);
   if(MA_Handle != INVALID_HANDLE) IndicatorRelease(MA_Handle);
ObjectsDeleteAll (0, "UBS_");
Print(" 🛑 تم إيقاف الروبوت وتنظيف الشارت");
}

Han respondido

1
Desarrollador 1
Evaluación
(18)
Proyectos
22
18%
Arbitraje
8
38% / 38%
Caducado
3
14%
Trabaja
2
Desarrollador 2
Evaluación
(8)
Proyectos
8
0%
Arbitraje
2
50% / 0%
Caducado
1
13%
Trabaja
3
Desarrollador 3
Evaluación
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
4
Desarrollador 4
Evaluación
(13)
Proyectos
20
45%
Arbitraje
6
33% / 17%
Caducado
2
10%
Trabajando
Ha publicado: 7 artículos, 35 ejemplos
5
Desarrollador 5
Evaluación
(396)
Proyectos
511
23%
Arbitraje
60
57% / 25%
Caducado
60
12%
Trabaja
6
Desarrollador 6
Evaluación
(3)
Proyectos
4
0%
Arbitraje
1
100% / 0%
Caducado
1
25%
Libre
7
Desarrollador 7
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
8
Desarrollador 8
Evaluación
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
9
Desarrollador 9
Evaluación
(3)
Proyectos
8
63%
Arbitraje
0
Caducado
0
Trabaja
10
Desarrollador 10
Evaluación
(1)
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 1 ejemplo
11
Desarrollador 11
Evaluación
(3)
Proyectos
3
33%
Arbitraje
0
Caducado
0
Trabajando
12
Desarrollador 12
Evaluación
(28)
Proyectos
34
35%
Arbitraje
0
Caducado
2
6%
Libre
13
Desarrollador 13
Evaluación
(1)
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
14
Desarrollador 14
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
15
Desarrollador 15
Evaluación
(83)
Proyectos
95
32%
Arbitraje
9
22% / 56%
Caducado
5
5%
Trabaja
16
Desarrollador 16
Evaluación
(3)
Proyectos
2
0%
Arbitraje
1
0% / 100%
Caducado
0
Libre
17
Desarrollador 17
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 1 ejemplo
18
Desarrollador 18
Evaluación
(1)
Proyectos
1
0%
Arbitraje
1
0% / 100%
Caducado
0
Trabaja
19
Desarrollador 19
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
20
Desarrollador 20
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 1 ejemplo
Solicitudes similares
I want to Build a EA Robot that combine from my trading style and any conditions we can discussion. My trading style information below. 1 Set Up , 1 Rule , 1 Trade , 1 Session , 1 Target
Ich möchte einen professionellen Expert Advisor (EA) für MetaTrader 5 entwickeln lassen, der sich funktional am ThunderGold Scalper orientiert. Instrument: XAUUSD / GOLD Zeitrahmen: M15 Plattform: MetaTrader 5 / MQL5 Der EA soll eine eigene, nachprogrammierte Strategie verwenden und keine geschützten Quellcodes oder proprietären Dateien des Originalprodukts kopieren. Gewünschte Funktionen: automatischer Handel auf
I need a fully automated Expert Advisor (EA) written in MQL5 for MetaTrader 5. The EA must work directly inside MT5 and must NOT require TradingView, PineConnector, webhooks, or another external connector to place trades. Trading Instrument Primary symbol: XAGUSD (Silver) My broker may display the symbol as XAGUSD-ECN, so the EA should work with the broker’s available XAGUSD symbol. Main entry timeframe: 5-minute
RECHERCHE DÉVELOPPEUR MQL5 — PARTENARIAT 50/50 Objectif : développer un EA de trading automatisé en 11 jours maximum pour participer à plusieurs concours de trading démo. Je recherche un développeur MQL5 expérimenté, capable de développer, tester et optimiser un EA proprement, avec une vraie maîtrise de la gestion du risque. CONCOURS VISÉS 🥇 XM — Weekly Demo Contest - Concours récurrent - Prize pool annoncé : 25 000
GoldTrade EA 89+ USD
//+------------------------------------------------------------------+ //| XAUUSD Wolfe + SMC Quick Profit EA | //| MT5 / MQL5 | //+------------------------------------------------------------------+ #property strict #include <Trade/Trade.mqh> CTrade trade; //================================================================== // INPUTS //================================================================== //--- General
can you help me with I have an indicator that I built and I work with PickMyTrade. The entries come through the alerts I get from Trading View . Trading View needs to send an alert and PickMyTrade executes a trade at that exact same second. Now, I have a problem in Trading View with the synchronization between the alert and the signal. I have a box that I built for a trade. It needs to output the box and get an
Looking for a developer in NinjaTrader For coding Inst - ES,NQ Chart type - Tick, range, volume & time Brief- Fib levels mapped on chart which act as entries, tgts and stops all based on candle close. (Maybe) use MACD for filtering direction. Daily manual input of the TWO fib Anchor levels is part of the strategy. I need a well experienced developer to bid and before biding check the attached file well. the PDF and
I Have an existing Mql5 Expert advisor (source code), I want a professional programmer to help me Modify the EA... so that it can stop taking new trades once it Gets to a Pacific Lots Size or Floating loss
I Have an existing Mql5 Expert advisor (source code), I want a professional programmer to help me Modify the EA... so that it can stop taking new trades once it Gets to a Pacific Lots Size or Floating loss
take your time better make it for days and have good bot than never benefits both of us. Make the bot have zero errors and backtest it for a 2 year period

Información sobre el proyecto

Presupuesto
68+ USD
Plazo límite de ejecución
de 15 a 33 día(s)

Cliente

Encargos realizados1
Número de arbitrajes0