初学者的问题 MQL5 MT5 MetaTrader 5 - 页 831

 
tsd Tsepkov:

我的意思是第一个名字,它说你必须把第一个名字改成真实的名字,但它不起作用。

是的,如果你的状态是 "卖方",你就不能编辑你的详细资料。

试着给servicedesk一份请求,并作出解释。

 
Vladimir Karputov:

是的,如果你的状态是 "卖方",你就不能编辑你的详细资料。

试着给servicedesk一份申请,并作出解释。

这就是问题所在,不,你必须通过编辑才能成为一个人。这是一个恶性循环...

您的卖家注册申请 已被版主拒绝。

请纠正你提供的数据。

 
tsd Tsepkov:

***

请纠正你所提供的数据

这可能是原因吗?图片是歪的,或暗的,或不符合要求的...

 
tsd Tsepkov:

这就是问题所在,不,你必须通过编辑才能成为一个人。这是一个恶性循环...

您注册为卖家的申请 已被版主拒绝。

请纠正你提供的数据。

好吧,那就给servicedesk写信说说这个问题。这比在论坛上敲打栏杆更有成效;)
 
VHS:

请告知在MQL5编程时,如何在自定义的Trailing类中使用标准CExpertSignal类的void Ignore(long value) { m_ignore=value; }方法?我怎样才能访问它?

我有一个自定义信号类,给我提供了开仓和平仓的方法。但在 "追踪 "中,我想通过另一种方法来保持位置。如果分别编写自定义类MySignal和MyTrailing,则通过首先触发的条件关闭头寸。如果尾随条件提前被触发,一切都很好。但有时从MySignal传来一个新的(反转)信号,头寸被反转,我需要它在开仓后伴有追踪,而不是平仓,也不是开新仓。我看了看基类,感觉是基类信号中的m_ignore负责这个问题。如果它在适当的过滤器中被赋值为1,似乎可以正常工作。我在OnInit中把filter0.Ignore(0)添加到Expert Advisor类中。但是我是OOP的新手,不明白如何在MyTrailing类中改变这个值,这个类不是继承自CExpertSignal类,而是它的 "表亲"(比方说filter0.Ignore(1) )。请告知如何做到这一点。

实际上,更普遍的问题是:如何在两个不是后代的类之间传递信息?如何将信息从尾随类转移到信号类?也许,你可以创建一个全局变量并通过它进行通信。但这对于OOP中受保护成员的逻辑来说,看起来完全是变态的。


请帮助我们!我已经试图远离构建忽略(当然,这本身并不好,人们试图将其纳入基本代码),但仍然找不到任何共同点。我正试图在第三天发明(我还没有拿到手册)。

我甚至调整了类的代码:我在MySignal类中实现了受保护的布尔成员(m_permition),并为其创建了一个Set方法;我把return(0)塞进了长除法,并在if !m_permition时拍了除法。在MyTrailing中还创建了一个受保护的布尔成员m_signal_permition,为它创建了Get和Set方法,教了CheckTrailing来控制它,如果(position==NULL){m_signal_permition = true; return(false);}否则m_signal_permition = false。

我不明白的只有一件事,我应该在哪里以及如何把它们放在一起。我试着在OnTick中简单地引用它们,但它失败了。

我读了弗拉基米尔的文章《如何教......》。在自定义信号中创建另一个信号的实例并通过它进行通信的想法似乎很清楚,但在我的系统中的某个地方,它并不完全合拍:信号和尾随的类并没有相互继承。

善意的人们,请以任何方式提供帮助。

 

同事们好。除了保护价,MT5报价还包含一些数据,如历史点差和滑点(默认情况下各地都一样,为10个五位数)。

通过在开仓后提出这样的要求。

Print("Expert name: ",__FILE__,", Открыта поза Sell с магиком №: ",IntegerToString(m_trade.RequestMagic()),", Cпред ",SymbolInfoInteger(_Symbol,SYMBOL_SPREAD),
", Deviation ",IntegerToString(m_trade.RequestDeviation()));

我们得到了这个答案。

我的理解是否正确,MT5测试器将点差和滑点一起计算,就像在MT4中我将手动设置点差为13点一样,对于截图中的具体例子。

 

你好,谁能帮帮我,我怎么能把MT5的EA链接到一个特定的账号 上?

 
denis basuk:

嗨,谁能帮帮我,我怎样才能把一个MT5专家顾问链接到一个特定的账号 上?

我需要检查账户号码。这应该在OnInit()和OnTick()中完成。例子。

 

你好,我正在尝试将指标从MT4转移到MT5。我有一个简单的指标,显示离下一个条形图的时间。本指标使用OnTimer。我在OnTimer中使用void refreshClock()函数更新它。对于其他需要使用OnTimer的指标,使用这种结构是否正确?或者你可以优化对OnTimer的寻址过程?

#property description "Time"
#property indicator_chart_window
#property indicator_plots   0

                                    
                                                                                             
input int Offset_Minutes = 60;                                                                                                         
input int Font__Size = 10;                                   
input color  Font_Color = clrWhite;                         
input color  Font_No_Bar_Color = clrRed;                        
input ENUM_BASE_CORNER  Corner = CORNER_RIGHT_UPPER;        
input int Time_X = 140;                                          
input int Time_Y = 0;                                            


#define  Clock_Name "Тimer"
int selectTime;
int diff;
int offsetHour;

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

int  OnInit()
{   
   EventSetMillisecondTimer(1000); 
   return(0); 
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

void OnDeinit(const int reason) 
{ 
   if(reason==REASON_REMOVE      || 
      reason==REASON_CHARTCHANGE || 
      reason==REASON_RECOMPILE   || 
      reason==REASON_CHARTCLOSE  || 
      reason==REASON_CLOSE       || 
      reason==REASON_PARAMETERS)    
   { 
     ObjectDelete(0, "Тimer");
     EventKillTimer(); 
   }
  ChartRedraw();
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

void OnTimer( )                 
{ 
   refreshClock();  
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

int  OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
   refreshClock();
   return(rates_total);
}
void refreshClock()
{
   static bool inRefresh = false;
           if (inRefresh) return;
               inRefresh = true;
                              ShowClock(); ChartRedraw();
               inRefresh=false;
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

void ShowClock()
{
   int periodMinutes     = periodToMinutes(Period());
   int currentTime       = (int)TimeCurrent();
   int localTime         = (int)TimeLocal();
   int barTime           = (int)iTime();
   
   diff = (int)MathMax(round((currentTime-localTime)/60.0)*60,-24*3600);
   offsetHour = (int)-Offset_Minutes*60; // сдвиг в минутах
   
   
   int currentTimeReal   = localTime+offsetHour;
   int sel_localTime     = localTime+diff;
   selectTime = sel_localTime;
   
     
      color  theColor;
      string time = getTime(barTime+periodMinutes*60-selectTime,theColor);
      int times = barTime+periodMinutes*60-selectTime;
      if(times < -60 || TerminalInfoInteger(TERMINAL_CONNECTED) == false || 
      currentTimeReal-currentTime > 60 || currentTime-currentTimeReal > 60)
      time = "Time Off";
             
   if(ObjectFind(0, Clock_Name) < 0)   
   ObjectCreate(0, Clock_Name, OBJ_LABEL, 0, 0, 0);
   ObjectSetString(0, Clock_Name, OBJPROP_TEXT, "Time: " + time);
   ObjectSetString(0, Clock_Name, OBJPROP_FONT, "Verdana");
   ObjectSetInteger(0, Clock_Name, OBJPROP_FONTSIZE, Font__Size);
   ObjectSetInteger(0, Clock_Name, OBJPROP_COLOR, theColor);
        ObjectSetInteger(0, Clock_Name, OBJPROP_CORNER, Corner);
        ObjectSetInteger(0, Clock_Name, OBJPROP_XDISTANCE, Time_X);
   ObjectSetInteger(0, Clock_Name, OBJPROP_YDISTANCE, Time_Y);
      
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

string getTime(int times, color& theColor)
{
   string stime = "";
   int    seconds;
   int    minutes;
   int    hours;
   int currentTime       = (int)TimeCurrent();
   int localTime         = (int)TimeLocal();
   
   
   offsetHour = (int)-Offset_Minutes*60;
   
   int currentTimeReal   = localTime+offsetHour;
  
   if (times < 0 || TerminalInfoInteger(TERMINAL_CONNECTED) == false || 
   currentTimeReal-currentTime > 60 || currentTime-currentTimeReal > 60) {
         theColor = Font_No_Bar_Color; times = (int)fabs(times); }
   else  theColor = Font_Color;
   
   seconds = (times%60);
   hours   = (times-times%3600)/3600;
   minutes = (times-seconds)/60-hours*60;

   if (hours>0)
   if (minutes < 10)
         stime = stime+(string)hours+":0";
   else  stime = stime+(string)hours+":";
         stime = stime+(string)minutes;
   if (seconds < 10)
         stime = stime+":0"+(string)seconds;
   else  stime = stime+":" +(string)seconds;
   return(stime);
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+
  
datetime iTime(ENUM_TIMEFRAMES forPeriod=PERIOD_CURRENT)
{
   datetime times[]; if (CopyTime(Symbol(),forPeriod,0,1,times)<=0) return(TimeLocal());
   return(times[0]);
}

//+------------------------------------------------------------------+  
  
//+------------------------------------------------------------------+

int periodToMinutes(int period)
{
   int i;
   static int _per[]={1,2,3,4,5,6,10,12,15,20,30,0x4001,0x4002,0x4003,0x4004,0x4006,0x4008,0x400c,0x4018,0x8001,0xc001};
   static int _min[]={1,2,3,4,5,6,10,12,15,20,30,60,120,180,240,360,480,720,1440,10080,43200};

   if (period==PERIOD_CURRENT)
       period = Period();  
            for(i=0;i<20;i++) if(period==_per[i]) break;
   return(_min[i]);  
}
 
VHS:

谁能帮帮我!?已经试图远离内置的忽略(当然,这本身并不好,人们试图将其纳入基本代码),但仍然无法连接。我正试图在第三天发明(我还没有拿到手册)。

我甚至调整了类的代码:我在MySignal类中实现了受保护的布尔成员(m_permition),并为它创建了一个Set方法;我把return(0)塞进了长除法,并在if !m_permition时拍了除法。在MyTrailing中还创建了一个受保护的布尔成员m_signal_permition,为它创建了Get和Set方法,教了CheckTrailing来控制它if(position==NULL) {m_signal_permition = true; return(false);}否则m_signal_permition = false。

我不明白的只有一件事,我应该在哪里以及如何把它们放在一起。我试着在OnTick中简单地引用它们,结果失败了。

我读了弗拉基米尔的文章《如何教......》。在自定义信号中创建另一个信号的实例并通过它进行通信的想法似乎很清楚,但在我的系统中的某个地方,它并不完全合拍:信号和尾随的类并没有相互继承。

善良的人们,请以任何方式帮助我。

我在一周内就取得了进展!在CExpert类中 发现信号方法。在OnTick中插入了代码。

CExpertSignal *my_signal = ExtExpert.Signal(); my_signal.Ignore(0);

现在,如果我手动改变括号中的 "1",Ingnore方法就会起作用--专家顾问不按信号执行交易。

现在只剩下了解如何在OnTick中获得尾随对象的信息。不幸的是,没有ExtExpert.Trailing()方法来获取对尾随对象的引用,因此,编译器不明白我想把我在尾随方法中实现的GetPermition应用到哪个对象。谁能告诉我该怎么做?