mql4 中的结构或类类型预期错误

问题描述

我正在使用 mql4 和面向对象的编程模型开发 MetaTrader 指标。我创建了一个视图文件一个控制器。我收到此错误: 'drawPairNamesListForex' - 预期的结构或类类型。 'IndicatorDashboard' - 未声明的标识符。

这是控制器:

int OnInit()
  {
    View IndicatorDashboard = new View();
    ShowHideForexScreenerState=false;
    IndicatorDashboard.ButtonCreate(0,prefix1+"ShowHideForexScreenerState",shiftX+BoxWidth*2,shiftY,BoxWidth*2,BoxHeight,CORNER_LEFT_UPPER,"FOREX",fontType,TaillePolice,ShowHide_Button_Text_Color,ShowHide_Button_Color,clrNONE,false,true);
    EventSetTimer(2);
    return(INIT_SUCCEEDED);
  }

void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
  int i = 0;
  string name = "";
  int XIncrimenet = shiftX;
  int YIncriment  = shiftY+(BoxHeight*1);
  if(sparam==prefix1+"ShowHideForexScreenerState" && !ShowHideForexScreenerState)
   {
      ShowHideForexScreenerState = true;
      IndicatorDashboard.drawPairNamesListForex();
   }

这是我从中获取“drawPairNamesListForex”方法的 View 类:

class View
  {
private:

public:
       void drawPairNamesListForex();
        View();
        ~View();
};

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


View::View()
  {
  
  }

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


View::~View()
  {
  
  }

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

void View::drawPairNamesListForex()
{
   int headerNumberInChart = 0;
   int XIncrimenet = shiftX;
   int YIncriement  = shiftY+BoxHeight;
   int indiceTablePairs         = 0;
   string pairNameCleaned       = NULL;
   int sizeSuffix               = StringLen(suffixPairs);
   int sizePreffix              = StringLen(prefixForex);
   int sizeAllThePair           = 0;
   int posiitonSuffix           = 0;
 
 for(int i = 0; i < ArraySize(ForexPair); i++ )
   {   
         pairNameCleaned = ForexPair[i];
         if (  sizeSuffix > 0 )  
           {
            sizeAllThePair    = StringLen(pairNameCleaned);
            posiitonSuffix    = StringFind(pairNameCleaned,suffixPairs);
            pairNameCleaned   = StringSubstr(pairNameCleaned,posiitonSuffix);
           }
          if ( sizePreffix > 0 )
           {
            sizeAllThePair    = StringLen(pairNameCleaned);
            pairNameCleaned   = StringSubstr(pairNameCleaned,sizePreffix,sizeAllThePair);
           }
         this.ButtonCreate(0,prefixForex+"PairName"+IntegerToString(i),shiftX,YIncriement,pairNameCleaned,textHeaderColor,headerColor,true);
         YIncriement+=BoxHeight;       
   }   
}



解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)