عرض مشاركة واحدة
قديم 13-09-2017, 06:12 PM   المشاركة رقم: 634
الكاتب
Rushdi
عضو متميز
الصورة الرمزية Rushdi

البيانات
تاريخ التسجيل: Oct 2011
رقم العضوية: 6474
الدولة: تركيا & العراق
العمر: 40
المشاركات: 1,334
بمعدل : 0.29 يوميا

الإتصالات
الحالة:
Rushdi غير متواجد حالياً
وسائل الإتصال:

كاتب الموضوع : اسلام العوامى المنتدى : منتدى المؤشرات و الاكسبيرتات
5 رد: موضوع مخصص للاسئلة والاستفسارات الخاصة بدورة تعليم البرمجة الاحترافية بلغة mql4

مرحباً استاذ اسلام والاخوة المختصين. شكراً على الدورة والمجهود الرائع

برمجت اكسبرت بسيط من اجل التعليم حسب خطوات الاستاذ اسلام لكن بيطلعلي تنبيه TestGenerator: unmatched data error mismatched ولا يقوم الاكسبرت بفتح صفقات كما مبين في الصورة

نقره لعرض الصورة في صفحة مستقلة

ارجوا من الاساتذة المساعدة

الكود


كود:
  //+------------------------------------------------------------------+
//|                                                       Deneme.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

extern double LotSize=0.1;
extern double StopLossPips=60;
extern double TakeProfitPips=60;
extern int MagicNumber = 55558;
extern int matimeframe = 240;
extern int maperiod = 8;
extern int mashift  = 0;
extern int mamethod = 0;
extern int maappliedprice=0;

extern int sartimeframe=240;
extern double sarstep=0.02;
extern double sarmaximum=0.2;
extern int sarshift=0;
double t;

double buyt,buys,selt,sels;

double ma1 = iMA(NULL,matimeframe,maperiod,mashift,mamethod,maappliedprice,1);
double ma2 = iMA(NULL,matimeframe,maperiod,mashift,mamethod,maappliedprice,2);


double sar1 = iSAR (NULL,sartimeframe,sarstep,sarmaximum,1);
double sar2 = iSAR (NULL,sartimeframe,sarstep,sarmaximum,2);


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---

   double tik=MarketInfo(Symbol(),MODE_TICKSIZE);
   if(tik==0.00001 || 0.001)
      t=tik*10;
   else t=tik;

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()

  {

   if(sar1 < ma1 && sar2< ma2)
      if(OrdersTotal()==0)
         if(StopLossPips==0)buys=0;
   else buys=Ask -(StopLossPips*t);
   if(TakeProfitPips==0)buyt=0;
   else buyt=Ask+(TakeProfitPips*t);

  bool x = OrderSend
   (Symbol(),OP_BUY,LotSize,Ask,5,buys,buyt,NULL,MagicNumber,Red);

   if(sar1<ma1 && sar2<ma2)
      if(OrdersTotal()==0)
         if(StopLossPips==0)sels=0;

   else sels=Bid+(StopLossPips*t);
   if(TakeProfitPips==0)selt=0;
   else selt=Ask -(TakeProfitPips*t);
  bool x2 = OrderSend
   (Symbol(),OP_SELL,LotSize,Bid,5,sels,selt,NULL,MagicNumber,Red);

//---

//---
   return(0);
  }
  
  
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+

/// Gets the error description
///
string GetErrorDescription(int iLastError)
  {
   string sErrorDescription="Unknown error";

   switch(iLastError)
     {
      case 0:    sErrorDescription = "No value";                                                 break;
      case 1:    sErrorDescription = "No error";                                                 break;
      case 2:    sErrorDescription = "Common error";                                             break;
      case 3:    sErrorDescription = "Invalid trade parameters";                                 break;
      case 4:    sErrorDescription = "Trade server is busy";                                     break;
      case 5:    sErrorDescription = "Old version of the client terminal";                       break;
      case 6:    sErrorDescription = "No connection with trade server";                          break;
      case 7:    sErrorDescription = "Not enough rights";                                        break;
      case 8:    sErrorDescription = "Too frequent requests";                                    break;
      case 9:    sErrorDescription = "Malfunctional trade operation (never returned error)";     break;
      case 64:   sErrorDescription = "Account disabled";                                         break;
      case 65:   sErrorDescription = "Invalid account";                                          break;
      case 128:  sErrorDescription = "Trade timeout";                                            break;
      case 129:  sErrorDescription = "Invalid price";                                            break;
      case 130:  sErrorDescription = "Invalid stops";                                            break;
      case 131:  sErrorDescription = "Invalid trade volume";                                     break;
      case 132:  sErrorDescription = "Market is closed";                                         break;
      case 133:  sErrorDescription = "Trade is disabled";                                        break;
      case 134:  sErrorDescription = "return value of 'OrderSelect' should be checked";          break;
      case 135:  sErrorDescription = "Price changed";                                            break;
      case 136:  sErrorDescription = "return value of 'OrderSend' should be checked";            break;
      case 137:  sErrorDescription = "Broker is busy (never returned error)";                    break;
      case 138:  sErrorDescription = "Requote";                                                  break;
      case 139:  sErrorDescription = "Order is locked";                                          break;
      case 140:  sErrorDescription = "Long positions only allowed";                              break;
      case 141:  sErrorDescription = "Too many requests";                                        break;
      case 145:  sErrorDescription = "Modification denied because order too close to market";    break;
      case 146:  sErrorDescription = "Trade context is busy";                                    break;
      case 147:  sErrorDescription = "Expirations are denied by broker";                         break;
      case 148:  sErrorDescription = "Amount of open and pending orders has reached the limit";  break;
      case 4000: sErrorDescription = "No error (never generated code)";                          break;
      case 4001: sErrorDescription = "Wrong function pointer";                                   break;
      case 4002: sErrorDescription = "Array index is out of range";                              break;
      case 4003: sErrorDescription = "No memory for function call stack";                        break;
      case 4004: sErrorDescription = "Recursive stack overflow";                                 break;
      case 4005: sErrorDescription = "Not enough stack for parameter";                           break;
      case 4006: sErrorDescription = "No memory for parameter string";                           break;
      case 4007: sErrorDescription = "No memory for temp string";                                break;
      case 4008: sErrorDescription = "Not initialized string";                                   break;
      case 4009: sErrorDescription = "Not initialized string in array";                          break;
      case 4010: sErrorDescription = "No memory for array\' string";                             break;
      case 4011: sErrorDescription = "Too long string";                                          break;
      case 4012: sErrorDescription = "Remainder from zero divide";                               break;
      case 4013: sErrorDescription = "Zero divide";                                              break;
      case 4014: sErrorDescription = "Unknown command";                                          break;
      case 4015: sErrorDescription = "Wrong jump (never generated error)";                       break;
      case 4016: sErrorDescription = "Not initialized array";                                    break;
      case 4017: sErrorDescription = "Dll calls are not allowed";                                break;
      case 4018: sErrorDescription = "Cannot load library";                                      break;
      case 4019: sErrorDescription = "Cannot call function";                                     break;
      case 4020: sErrorDescription = "Expert function calls are not allowed";                    break;
      case 4021: sErrorDescription = "Not enough memory for temp string returned from function"; break;
      case 4022: sErrorDescription = "System is busy (never generated error)";                   break;
      case 4050: sErrorDescription = "Invalid function parameters count";                        break;
      case 4051: sErrorDescription = "Invalid function parameter value";                         break;
      case 4052: sErrorDescription = "String function internal error";                           break;
      case 4053: sErrorDescription = "Some array error";                                         break;
      case 4054: sErrorDescription = "Incorrect series array using";                             break;
      case 4055: sErrorDescription = "Custom indicator error";                                   break;
      case 4056: sErrorDescription = "Arrays are incompatible";                                  break;
      case 4057: sErrorDescription = "Global variables processing error";                        break;
      case 4058: sErrorDescription = "Global variable not found";                                break;
      case 4059: sErrorDescription = "Function is not allowed in testing mode";                  break;
      case 4060: sErrorDescription = "Function is not confirmed";                                break;
      case 4061: sErrorDescription = "Send mail error";                                          break;
      case 4062: sErrorDescription = "String parameter expected";                                break;
      case 4063: sErrorDescription = "Integer parameter expected";                               break;
      case 4064: sErrorDescription = "Double parameter expected";                                break;
      case 4065: sErrorDescription = "Array as parameter expected";                              break;
      case 4066: sErrorDescription = "Requested history data in update state";                   break;
      case 4099: sErrorDescription = "End of file";                                              break;
      case 4100: sErrorDescription = "Some file error";                                          break;
      case 4101: sErrorDescription = "Wrong file name";                                          break;
      case 4102: sErrorDescription = "Too many opened files";                                    break;
      case 4103: sErrorDescription = "Cannot open file";                                         break;
      case 4104: sErrorDescription = "Incompatible access to a file";                            break;
      case 4105: sErrorDescription = "No order selected";                                        break;
      case 4106: sErrorDescription = "Unknown symbol";                                           break;
      case 4107: sErrorDescription = "Invalid price parameter for trade function";               break;
      case 4108: sErrorDescription = "Invalid ticket";                                           break;
      case 4109: sErrorDescription = "Trade is not allowed in the expert properties";            break;
      case 4110: sErrorDescription = "Longs are not allowed in the expert properties";           break;
      case 4111: sErrorDescription = "Shorts are not allowed in the expert properties";          break;
      case 4200: sErrorDescription = "Object is already exist";                                  break;
      case 4201: sErrorDescription = "Unknown object property";                                  break;
      case 4202: sErrorDescription = "Object is not exist";                                      break;
      case 4203: sErrorDescription = "Unknown object type";                                      break;
      case 4204: sErrorDescription = "No object name";                                           break;
      case 4205: sErrorDescription = "Object coordinates error";                                 break;
      case 4206: sErrorDescription = "No specified subwindow";                                   break;
      default:   sErrorDescription = "Unknown error";
     }

   return(sErrorDescription);
  }
//+------------------------------------------------------------------+



التوقيع

نقره لعرض الصورة في صفحة مستقلة

أزل عن نفسك ضغط السوق مع استراحة طربية


استراحة طربية

عرض البوم صور Rushdi  
رد مع اقتباس
  #634  
قديم 13-09-2017, 06:12 PM
Rushdi Rushdi غير متواجد حالياً
عضو متميز
5 رد: موضوع مخصص للاسئلة والاستفسارات الخاصة بدورة تعليم البرمجة الاحترافية بلغة mql4

مرحباً استاذ اسلام والاخوة المختصين. شكراً على الدورة والمجهود الرائع

برمجت اكسبرت بسيط من اجل التعليم حسب خطوات الاستاذ اسلام لكن بيطلعلي تنبيه TestGenerator: unmatched data error mismatched ولا يقوم الاكسبرت بفتح صفقات كما مبين في الصورة

نقره لعرض الصورة في صفحة مستقلة

ارجوا من الاساتذة المساعدة

الكود


كود:
  //+------------------------------------------------------------------+
//|                                                       Deneme.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

extern double LotSize=0.1;
extern double StopLossPips=60;
extern double TakeProfitPips=60;
extern int MagicNumber = 55558;
extern int matimeframe = 240;
extern int maperiod = 8;
extern int mashift  = 0;
extern int mamethod = 0;
extern int maappliedprice=0;

extern int sartimeframe=240;
extern double sarstep=0.02;
extern double sarmaximum=0.2;
extern int sarshift=0;
double t;

double buyt,buys,selt,sels;

double ma1 = iMA(NULL,matimeframe,maperiod,mashift,mamethod,maappliedprice,1);
double ma2 = iMA(NULL,matimeframe,maperiod,mashift,mamethod,maappliedprice,2);


double sar1 = iSAR (NULL,sartimeframe,sarstep,sarmaximum,1);
double sar2 = iSAR (NULL,sartimeframe,sarstep,sarmaximum,2);


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---

   double tik=MarketInfo(Symbol(),MODE_TICKSIZE);
   if(tik==0.00001 || 0.001)
      t=tik*10;
   else t=tik;

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()

  {

   if(sar1 < ma1 && sar2< ma2)
      if(OrdersTotal()==0)
         if(StopLossPips==0)buys=0;
   else buys=Ask -(StopLossPips*t);
   if(TakeProfitPips==0)buyt=0;
   else buyt=Ask+(TakeProfitPips*t);

  bool x = OrderSend
   (Symbol(),OP_BUY,LotSize,Ask,5,buys,buyt,NULL,MagicNumber,Red);

   if(sar1<ma1 && sar2<ma2)
      if(OrdersTotal()==0)
         if(StopLossPips==0)sels=0;

   else sels=Bid+(StopLossPips*t);
   if(TakeProfitPips==0)selt=0;
   else selt=Ask -(TakeProfitPips*t);
  bool x2 = OrderSend
   (Symbol(),OP_SELL,LotSize,Bid,5,sels,selt,NULL,MagicNumber,Red);

//---

//---
   return(0);
  }
  
  
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+

/// Gets the error description
///
string GetErrorDescription(int iLastError)
  {
   string sErrorDescription="Unknown error";

   switch(iLastError)
     {
      case 0:    sErrorDescription = "No value";                                                 break;
      case 1:    sErrorDescription = "No error";                                                 break;
      case 2:    sErrorDescription = "Common error";                                             break;
      case 3:    sErrorDescription = "Invalid trade parameters";                                 break;
      case 4:    sErrorDescription = "Trade server is busy";                                     break;
      case 5:    sErrorDescription = "Old version of the client terminal";                       break;
      case 6:    sErrorDescription = "No connection with trade server";                          break;
      case 7:    sErrorDescription = "Not enough rights";                                        break;
      case 8:    sErrorDescription = "Too frequent requests";                                    break;
      case 9:    sErrorDescription = "Malfunctional trade operation (never returned error)";     break;
      case 64:   sErrorDescription = "Account disabled";                                         break;
      case 65:   sErrorDescription = "Invalid account";                                          break;
      case 128:  sErrorDescription = "Trade timeout";                                            break;
      case 129:  sErrorDescription = "Invalid price";                                            break;
      case 130:  sErrorDescription = "Invalid stops";                                            break;
      case 131:  sErrorDescription = "Invalid trade volume";                                     break;
      case 132:  sErrorDescription = "Market is closed";                                         break;
      case 133:  sErrorDescription = "Trade is disabled";                                        break;
      case 134:  sErrorDescription = "return value of 'OrderSelect' should be checked";          break;
      case 135:  sErrorDescription = "Price changed";                                            break;
      case 136:  sErrorDescription = "return value of 'OrderSend' should be checked";            break;
      case 137:  sErrorDescription = "Broker is busy (never returned error)";                    break;
      case 138:  sErrorDescription = "Requote";                                                  break;
      case 139:  sErrorDescription = "Order is locked";                                          break;
      case 140:  sErrorDescription = "Long positions only allowed";                              break;
      case 141:  sErrorDescription = "Too many requests";                                        break;
      case 145:  sErrorDescription = "Modification denied because order too close to market";    break;
      case 146:  sErrorDescription = "Trade context is busy";                                    break;
      case 147:  sErrorDescription = "Expirations are denied by broker";                         break;
      case 148:  sErrorDescription = "Amount of open and pending orders has reached the limit";  break;
      case 4000: sErrorDescription = "No error (never generated code)";                          break;
      case 4001: sErrorDescription = "Wrong function pointer";                                   break;
      case 4002: sErrorDescription = "Array index is out of range";                              break;
      case 4003: sErrorDescription = "No memory for function call stack";                        break;
      case 4004: sErrorDescription = "Recursive stack overflow";                                 break;
      case 4005: sErrorDescription = "Not enough stack for parameter";                           break;
      case 4006: sErrorDescription = "No memory for parameter string";                           break;
      case 4007: sErrorDescription = "No memory for temp string";                                break;
      case 4008: sErrorDescription = "Not initialized string";                                   break;
      case 4009: sErrorDescription = "Not initialized string in array";                          break;
      case 4010: sErrorDescription = "No memory for array\' string";                             break;
      case 4011: sErrorDescription = "Too long string";                                          break;
      case 4012: sErrorDescription = "Remainder from zero divide";                               break;
      case 4013: sErrorDescription = "Zero divide";                                              break;
      case 4014: sErrorDescription = "Unknown command";                                          break;
      case 4015: sErrorDescription = "Wrong jump (never generated error)";                       break;
      case 4016: sErrorDescription = "Not initialized array";                                    break;
      case 4017: sErrorDescription = "Dll calls are not allowed";                                break;
      case 4018: sErrorDescription = "Cannot load library";                                      break;
      case 4019: sErrorDescription = "Cannot call function";                                     break;
      case 4020: sErrorDescription = "Expert function calls are not allowed";                    break;
      case 4021: sErrorDescription = "Not enough memory for temp string returned from function"; break;
      case 4022: sErrorDescription = "System is busy (never generated error)";                   break;
      case 4050: sErrorDescription = "Invalid function parameters count";                        break;
      case 4051: sErrorDescription = "Invalid function parameter value";                         break;
      case 4052: sErrorDescription = "String function internal error";                           break;
      case 4053: sErrorDescription = "Some array error";                                         break;
      case 4054: sErrorDescription = "Incorrect series array using";                             break;
      case 4055: sErrorDescription = "Custom indicator error";                                   break;
      case 4056: sErrorDescription = "Arrays are incompatible";                                  break;
      case 4057: sErrorDescription = "Global variables processing error";                        break;
      case 4058: sErrorDescription = "Global variable not found";                                break;
      case 4059: sErrorDescription = "Function is not allowed in testing mode";                  break;
      case 4060: sErrorDescription = "Function is not confirmed";                                break;
      case 4061: sErrorDescription = "Send mail error";                                          break;
      case 4062: sErrorDescription = "String parameter expected";                                break;
      case 4063: sErrorDescription = "Integer parameter expected";                               break;
      case 4064: sErrorDescription = "Double parameter expected";                                break;
      case 4065: sErrorDescription = "Array as parameter expected";                              break;
      case 4066: sErrorDescription = "Requested history data in update state";                   break;
      case 4099: sErrorDescription = "End of file";                                              break;
      case 4100: sErrorDescription = "Some file error";                                          break;
      case 4101: sErrorDescription = "Wrong file name";                                          break;
      case 4102: sErrorDescription = "Too many opened files";                                    break;
      case 4103: sErrorDescription = "Cannot open file";                                         break;
      case 4104: sErrorDescription = "Incompatible access to a file";                            break;
      case 4105: sErrorDescription = "No order selected";                                        break;
      case 4106: sErrorDescription = "Unknown symbol";                                           break;
      case 4107: sErrorDescription = "Invalid price parameter for trade function";               break;
      case 4108: sErrorDescription = "Invalid ticket";                                           break;
      case 4109: sErrorDescription = "Trade is not allowed in the expert properties";            break;
      case 4110: sErrorDescription = "Longs are not allowed in the expert properties";           break;
      case 4111: sErrorDescription = "Shorts are not allowed in the expert properties";          break;
      case 4200: sErrorDescription = "Object is already exist";                                  break;
      case 4201: sErrorDescription = "Unknown object property";                                  break;
      case 4202: sErrorDescription = "Object is not exist";                                      break;
      case 4203: sErrorDescription = "Unknown object type";                                      break;
      case 4204: sErrorDescription = "No object name";                                           break;
      case 4205: sErrorDescription = "Object coordinates error";                                 break;
      case 4206: sErrorDescription = "No specified subwindow";                                   break;
      default:   sErrorDescription = "Unknown error";
     }

   return(sErrorDescription);
  }
//+------------------------------------------------------------------+




رد مع اقتباس