错误、漏洞、问题 - 页 1110

 
barabashkakvn:
你对MetaEditor5感到困惑吗?
我在MT4上交易,并通过存储与我工作中的电脑进行代码同步。我的金库在MetaEditor4上工作。
 
paladin800:
我在MT4上交易,并通过存储与我工作中的电脑进行代码同步。我把金库放在MetaEditor4上运行。

你在MT5和MT4上有不同的登录方式吗?

 
barabashkakvn:

你是否有不同的MT5和MT4登录?

在MT4上,我输入了5号论坛上的登录名和密码。你 需要像4号文件那样输入登录名和密码。
 
barabashkakvn:

你的MT5和MT4登录方式不同吗?

paladin800
在MT4上,我输入了5sh论坛上的登录和密码。
真是个奇迹啊!事实证明,我应该先把文件 添加到MetaEditor4,而我却试图先从资源库中提取
 

为什么不在全局范围内创建类对象

'CBaseClass' - 没有类型的声明 !Draft.mq5 12 1


#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
CBaseClass BaseClass; 
//+------------------------------------------------------------------+
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  }
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
class CBaseClass
 {
   protected:
   
   public:
   CBaseClass() {};
   ~CBaseClass() {};
 };
 
silhouette:

这是个好办法。

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
class CBaseClass;
CBaseClass BaseClass; 
//+------------------------------------------------------------------+
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  }
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
class CBaseClass
 {
   protected:
   
   public:
   CBaseClass() {};
   ~CBaseClass() {};
 };
 
TheXpert:

这是个好办法。

或者说像这样?也就是说,在创建对象 之前,类的描述应该是严格的?

谢谢你。

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
class CBaseClass
 {
   protected:
   
   public:
   CBaseClass() {};
   ~CBaseClass() {};
 };
CBaseClass BaseClass; 
//+------------------------------------------------------------------+
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  }
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
 
silhouette:

好吧,我写的是为了让它发挥作用,以防你想在底部保留类的定义。

剪影

这样说对吗?也就是说,在创建对象 之前,类的描述应该是严格的?

如果有一个声明,描述可以在任何地方。
 
TheXpert:

好吧,我写了它,以备你想在底部保留类的定义。

在这种情况下,会检测到一个错误

'CBaseClass' - 结构未定义 !Draft.mq5 13 1

 
我如何为两个图形结构 指定四种颜色?我设置了颜色,但后来我只能得到2个。


#property indicator_separate_window

#property indicator_buffers 10
#property indicator_plots 2                    
#property indicator_type1 DRAW_COLOR_CANDLES 
#property indicator_type2 DRAW_COLOR_CANDLES 



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
        PlotIndexSetInteger(0,PLOT_LINE_COLOR,0, clrBlue);
        PlotIndexSetInteger(0,PLOT_LINE_COLOR,1, clrYellow);
       
        PlotIndexSetInteger(1,PLOT_LINE_COLOR,0, clrGreen);
        PlotIndexSetInteger(1,PLOT_LINE_COLOR,1, clrRed);
       
        Print("00 = " + PlotIndexGetInteger(0, PLOT_LINE_COLOR,0));
        Print("01 = " + PlotIndexGetInteger(0, PLOT_LINE_COLOR,1));
        Print("10 = " + PlotIndexGetInteger(1, PLOT_LINE_COLOR,0));
        Print("11 = " + PlotIndexGetInteger(1, PLOT_LINE_COLOR,1));
       
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---
  
//--- return value of prev_calculated for next call
   return(rates_total);
  }