错误、漏洞、问题 - 页 991

 
costy_:

当我调用它时,我得到

2013.05.31 13:08:41 temp (AUDUSD,M5) TERMINAL_COMPANY = MetaQuotes Software Corp.

它应该是不同的经纪人,或者有什么问题,谢谢。

 AccountInfoString(ACCOUNT_SERVER)

终端属于MetaQuotes软件公司。

brokerAccountInfoString(ACCOUNT_SERVER)

 
pako:

终端属于MetaQuotes软件公司。

brokerAccountInfoString(ACCOUNT_SERVER)

谢谢,我毕竟失去了它。
 

下午好!

我正在编写一个多货币指标。当我再次修改代码时,它编译得很好,但当我试图把指标放在图表上时,我得到 "无效的ex5文件"。我试着用不同的名字重新保存它--同样的事情。事实证明,问题出在代码中,但编译没有问题。

//+------------------------------------------------------------------+
//|                                                      Therm02.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+

#include <ST_ServicesAndAbstracts.mqh>

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 120
#property indicator_buffers 1
#property indicator_plots   2
//--- plot Label1
#property  indicator_label1  "Label1"
#property  indicator_type1   DRAW_LINE
#property  indicator_color1  clrBlack
#property  indicator_style1  STYLE_SOLID
#property  indicator_width1  1
//--- indicator buffers
double         gThermB[];

double         gEURThermB[];
double         gCHFThermB[];

CRangeManager  *gEURRM, *gCHFRM;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(0,gCHFThermB,INDICATOR_DATA);
   gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   )

  {
//---
   double lEUR[], lCHF[];
   int copied;
   copied=CopyClose("EURUSD",PERIOD_CURRENT,0,5000,lEUR); 
   if (copied==-1){Print("Ждите...EUR");return(0);}
   copied=CopyClose("USDCHF",PERIOD_CURRENT,0,5000,lCHF); 
   if (copied==-1){Print("Ждите...CHF");return(0);}


   sThermometer lT;
   for(int i=prev_calculated;i<rates_total;i++)
      {
         lT = gEURRM.getState(lEUR[i]);
         gEURThermB[i] = lT.currentT; 
         
         lT = gEURRM.getState(lCHF[i]);
         gEURThermB[i] = lT.currentT; 
      }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+

我怎样才能提供帮助?

谢谢你!

 
ns_k:

下午好!

我正在编写一个多货币指标。当我再次修改代码时,它编译得很好,但当我试图把指标放在图表上时,我得到 "无效的ex5文件"。我试着用不同的名字重新保存它--同样的事情。事实证明,问题出在代码中,但编译没有问题。

我怎样才能提供帮助?

谢谢你!

编译过程中是否没有任何错误或警告?它是否准确?
 
tol64:
编译过程中是否没有错误或警告?你确定吗?
没有错误,有警告,大多是无害的,如未使用的值。但有这样一个指标,缓冲区的数量少于需要。我将尝试在这里挖掘

 
ns_k:
没有错误,有警告,大多数是无害的,如未使用的值。然而,有这样一个指标缓冲区的数量少于需要。我试着在这里挖一下。

是的,这正是它。这就是错误所在。

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(0,gCHFThermB,INDICATOR_DATA);
   gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
突出显示为红色。替 换为1
 
#property indicator_buffers 1
#property indicator_plots   2
缓冲区的数量不能 少于地块的数量。这就是编译器在信息中告诉你的内容。
 
tol64:

是的,这正是它。这就是问题所在。

突出显示为红色。替 换为1
#property indicator_buffers 1
#property indicator_plots   2
Спасибо всем!
 
ns_k:

MT4内置500。我把警报设置为某个级别,它就会响,一切都很好。我取消了警报(空格),它显示为暂停。然后仪器达到阈值,警报被触发。应该是这样的吗?

ps.是的,一个侧面说明。首先,我用鼠标突出了所有的警报(6个),并按下空格键,它们都变成了悬浮状态。在触发了一个之后,我已经用空格键关闭了它,但它仍然在触发。

 

我还要再撒一些。

//+------------------------------------------------------------------+
//|                                                      Therm02.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+

//#include <ST_ServicesAndAbstracts.mqh>

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 120
#property indicator_buffers 2
#property indicator_plots   2
//--- plot Label1
#property  indicator_label1  "Label1"

#property  indicator_type1   DRAW_LINE
#property  indicator_color1  clrBlack
#property  indicator_style1  STYLE_SOLID
#property  indicator_width1  1
//--- indicator buffers
double         gThermB[];

double         gEURThermB[];
double         gCHFThermB[];

//CRangeManager  *gEURRM, *gCHFRM;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(1,gCHFThermB,INDICATOR_DATA);
   //gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   //gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   )

  {
//---
   double lEUR[], lCHF[];
   int copied;
  // copied=CopyClose("EURUSD",PERIOD_CURRENT,0,5000,lEUR); 
   if (copied==-1){Print("Ждите...EUR");return(0);}
  // copied=CopyClose("USDCHF",PERIOD_CURRENT,0,5000,lCHF); 
   if (copied==-1){Print("Ждите...CHF");return(0);}


   //sThermometer lT;
   for(int i=prev_calculated;i<5000;i++)
      {
         //lT = gEURRM.getState(lEUR[i]);
       //  gEURThermB[i] = lT.currentT; 
         
     //    lT = gCHFRM.getState(lCHF[i]);
     //    gCHFThermB[i] = lT.currentT; 
      }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+

在启动时,终端 发誓没有选择指定的符号。我已经通过云端把它拖到另一个MT5上--它可以工作,而且是用tickers的注释字符串。

我想试着找到原因,但我不知道从哪里开始搜索这样一个游离的错误。也许我应该一下子重新安装终端?