错误、漏洞、问题 - 页 2409

 
亲爱的开发者们!你要修复这个网站吗?每次我进去的时候,都有一个关于产品更新的通知。我看了看这个警报,它又出现了。它不应该是这样的!
 
Alexey Kozitsyn:
亲爱的开发者们!你要修复这个网站吗?每次我进来的时候--都有产品更新的通知。我看了看这个警报,又出现了这种情况。它不应该是这样的!


我没有这种错误的产品。

有一个普遍的错误是不读信息

该错误发生在几个标签打开的时候,直到你关闭它们,它们将不会被读取。

还有一件事--你必须去看这个消息两次--然后它就会被标记为已读。

这可能有助于开发者。

 

指标图缺失(期货 合约 指标,如果不是BR-4.19,则输入int NextFutMonth = 3; //期货NextFutMonth(月))。

//+------------------------------------------------------------------+
//|                                                   BR_Scalper.mq5 |
//|                                      Copyright 2019 prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019 prostotrader"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1

//--- plot Label1
#property indicator_label1  "Spread"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrYellow
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

//#property indicator_maximum 30
//#property indicator_minimum -30

#define  on_call -111
//
input int NextFutMonth = 1;    //След фьючерс (мес.)
input int aBars = 30;          //Бары  
//
double Buff[];
double pr_last, sec_last;
string sec_symbol;
bool pr_book, sec_book;
int event_cnt;

//+------------------------------------------------------------------+
//| Indicator Set second Symbols function                            |
//+------------------------------------------------------------------+
string SetSecSymbol(const string aSymbol)
{
  int str_tire = StringFind(aSymbol, "-");
  int str_tochka = StringFind(aSymbol, ".", str_tire);
  int str_size = StringLen(aSymbol);
  if((str_tire > 0) && (str_tochka > 0) && (str_size > 0))
  {
    string str_month = StringSubstr(aSymbol, str_tire + 1, str_tochka - str_tire - 1);
    string str_year = StringSubstr(aSymbol, str_tochka + 1, str_size - str_tochka - 1);
    long aMonth = StringToInteger(str_month);
    long aYear = StringToInteger(str_year);
    if((aMonth > 0) && (aYear > 0))
    {
      long n_month = aMonth + long(NextFutMonth);
      long add_year = (n_month - 1) / 12;
      aYear += add_year;
      str_year = IntegerToString(aYear); 
      aMonth = n_month - add_year * 12;
      str_month = IntegerToString(aMonth);
      return(StringSubstr(aSymbol, 0, str_tire + 1) + str_month + "." + str_year);
    } 
  }
  return("");
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
  int a_bars = Bars(Symbol(), PERIOD_CURRENT);
  if(a_bars < aBars + 1)
  {
    Alert("На графике не хватает баров!");
    return(INIT_FAILED);
  } 
  event_cnt = 0;
  sec_symbol = SetSecSymbol(Symbol());
  if(SymbolSelect(sec_symbol, true) == false) return(INIT_FAILED);
  pr_book = MarketBookAdd(Symbol());
  sec_book = MarketBookAdd(sec_symbol);
  IndicatorSetInteger(INDICATOR_DIGITS, 0);
  IndicatorSetString(INDICATOR_SHORTNAME, "BR_Scalper");
//---  
  SetIndexBuffer(0, Buff, INDICATOR_DATA);
  PlotIndexSetDouble( 0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
  ArraySetAsSeries(Buff, true );
  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
// Custom indicator DeInit function                                  |
//+------------------------------------------------------------------+
void OnDeinit( const int reason )
{
  if(pr_book == true) MarketBookRelease(Symbol());
  if(sec_book == true) MarketBookRelease(sec_symbol);
  if(reason == REASON_INITFAILED)
  {
    Print("Индикатор удалён! Причина - ошибка инициализации.");
    string short_name = ChartIndicatorName(ChartID(), 1, 0);
    ChartIndicatorDelete(ChartID(), 1, short_name); 
  }
}
//+------------------------------------------------------------------+
// Custom indicator On book event function                           |
//+------------------------------------------------------------------+
void OnBookEvent( const string& symbol )
{
  if((symbol == Symbol()) || (symbol == sec_symbol))
  {
    sec_last = SymbolInfoDouble(sec_symbol, SYMBOL_LAST);
    pr_last = SymbolInfoDouble(Symbol(), SYMBOL_LAST);
    double price[]; 
    OnCalculate( event_cnt, event_cnt, on_call, price ); 
  }
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
{
  if(prev_calculated == 0)
  {
    ArrayInitialize(Buff, EMPTY_VALUE);
  }
  else
  {
    if(begin == on_call)
    {
      for(int i = aBars - 1; i > 0; i--)
      {
        Buff[i] = Buff[i - 1];
      }
    }
    else
    {
     sec_last = SymbolInfoDouble(sec_symbol, SYMBOL_LAST);
     pr_last = SymbolInfoDouble(Symbol(), SYMBOL_LAST); 
     Buff[aBars] = EMPTY_VALUE;
    } 
    Buff[0] = (sec_last - pr_last) /Point();
  } 
//---    
  event_cnt = rates_total;  
//--- return value of prev_calculated for next call
  return(rates_total);
}
//+------------------------------------------------------------------+

但当你把

#property indicator_maximum 30
#property indicator_minimum -30

运行良好

 

测试者使用另一个工具的报价来关闭交易。


1.开盘欧元兑美元价格1.30935。

2.收盘价1.60704。没有这样的价格,但当时另一个工具gbpusd有这样的价格。





对两个符号eurusd和gbpusd进行测试。如果排除gbpusd,错误就会消失。


 
Aleksey Sergan:

测试者使用另一个工具的报价来关闭交易。


1.开盘欧元兑美元价格1.30935。

2.收盘价1.60704。这不是这样的价格,但当时是另一个符号gbpusd。





对两个符号eurusd和gbpusd进行测试。如果排除gbpusd,错误就会消失。


这个奇迹顾问的代码在哪里?我认为99%的情况是你在使用类,并在某处使用了静态变量

 
Vladimir Karputov:

这个奇迹顾问的代码在哪里?99%的人打赌你在工作中使用类,并在某处使用静态变量

弗拉基米尔,你在开玩笑吗?

 
Andrey Barinov:

弗拉基米尔,你在开玩笑吗?

我仍然在等待Aleksey Sergan 的答复 根据答案,会有第二个问题的主导部分。

 
Vladimir Karputov:

我仍然在等待Aleksey Sergan 的答复 根据答案,会有第二个问题的主导部分。

我明白了。所以你毕竟不是在开玩笑...

有时,一个终端错误只是一个终端错误。
 
Vladimir Karputov:

这个奇迹顾问的代码在哪里?99%的人打赌你在工作中使用类,并在某处使用静态变量

该代码有几千行。附上它没有任何意义。 没有静态变量。有的班级。无论怎样,这都是一个测试者的错误。

 
Andrey Barinov:

我明白了。所以你毕竟不是在开玩笑...

有时,一个终端错误只是一个终端错误。

哼哼 :)

原因: