Gold_Breakout_Ultimate_EA.mq5

Şartname

//+------------------------------------------------------------------+
//|                 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(" 🛑 تم إيقاف الروبوت وتنظيف الشارت");
}

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(18)
Projeler
22
18%
Arabuluculuk
8
38% / 38%
Süresi dolmuş
3
14%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(8)
Projeler
8
0%
Arabuluculuk
2
50% / 0%
Süresi dolmuş
1
13%
Çalışıyor
3
Geliştirici 3
Derecelendirme
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
4
Geliştirici 4
Derecelendirme
(13)
Projeler
20
45%
Arabuluculuk
6
33% / 17%
Süresi dolmuş
2
10%
Yüklendi
Yayınlandı: 7 makale, 35 kod
5
Geliştirici 5
Derecelendirme
(396)
Projeler
511
23%
Arabuluculuk
60
57% / 25%
Süresi dolmuş
60
12%
Çalışıyor
6
Geliştirici 6
Derecelendirme
(3)
Projeler
4
0%
Arabuluculuk
1
100% / 0%
Süresi dolmuş
1
25%
Serbest
7
Geliştirici 7
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
8
Geliştirici 8
Derecelendirme
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
9
Geliştirici 9
Derecelendirme
(3)
Projeler
8
63%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
10
Geliştirici 10
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
11
Geliştirici 11
Derecelendirme
(3)
Projeler
3
33%
Arabuluculuk
0
Süresi dolmuş
0
Yüklendi
12
Geliştirici 12
Derecelendirme
(28)
Projeler
34
35%
Arabuluculuk
0
Süresi dolmuş
2
6%
Serbest
13
Geliştirici 13
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
14
Geliştirici 14
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
15
Geliştirici 15
Derecelendirme
(83)
Projeler
95
32%
Arabuluculuk
9
22% / 56%
Süresi dolmuş
5
5%
Çalışıyor
16
Geliştirici 16
Derecelendirme
(3)
Projeler
2
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
17
Geliştirici 17
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
18
Geliştirici 18
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Çalışıyor
19
Geliştirici 19
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
20
Geliştirici 20
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
21
Geliştirici 21
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Benzer siparişler
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

Proje bilgisi

Bütçe
68+ USD
Son teslim tarihi
from 15 to 33 gün

Müşteri

Verilmiş siparişler1
Arabuluculuk sayısı0