エラー、バグ、質問 - ページ 2409

 
開発者の皆様へサイトを修正するつもりはないのですか?入るたびに製品更新のお知らせがある。このアラートを見ると、また出てくるんです。こんなはずではなかった!
 
Alexey Kozitsyn:
開発者の皆様へサイトを修正するつもりはないのですか?ログインするたびに、製品更新のお知らせが表示される。このアラートに目を通すと、また発生するんです。こんなはずではなかった!


製品によってこのようなエラーが出ることはないのですが。

メッセージを読まないという 一般的なエラーがあります。

複数のタブを開いている場合、それらを閉じるまで、読み込まれないというエラーが発生します。

もうひとつ、このメッセージに2回アクセスすると、既読になります。

開発者の方々の参考になるかもしれません。

 

指標となるチャートがない(先物取引の 指標、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にはそのような価格があった。





テストは2つのシンボルeurusdとgbpusdに対して行われます。gbpusdを除外すると、エラーは出なくなります。


 
Aleksey Sergan:

テスターが他の商品のクォートを使って取引を終了させる。


1.ユーロドル始値1.30935。

2.終値1.60704。そんな値段ではありませんでしたが、当時は別の楽器gbpusdのためにあったのです。





テストは2つのシンボルeurusdとgbpusdに対して行われます。gbpusdを除外すると、エラーは出なくなります。


このミラクルアドバイザーのコードはどこにあるのでしょうか?99%はクラスを使っていて、どこかでスタティック変 数を使用しているのだと思います。

 
Vladimir Karputov:

このミラクルアドバイザーのコードはどこにあるのでしょうか?99%はクラスで作業し、どこかで静的変数を 使用しているはずです。

ウラジミール、冗談だろう?

 
Andrey Barinov:

ウラジミール、冗談だろう?

アレクセイ・セルガンからの 返事を待っているところです 答えによっては、2つ目のリードパートがあります。

 
Vladimir Karputov:

アレクセイ・セルガンからの 返事を待っているところです 答えによっては、2つ目のリードパートがあります。

なるほど。やっぱり冗談じゃないんですね...。

端末のバグは端末のバグでしかないこともある。
 
Vladimir Karputov:

このミラクルアドバイザーのコードはどこにあるのでしょうか?99%はクラスで作業し、どこかで静的変数を 使用しているはずです。

コードは数千行に及びます。付ける意味がない。 静的変数がない。クラスがあります。いずれにせよテスターのミスです。

 
Andrey Barinov:

わかったよ。やっぱり冗談じゃないんですね...。

端末のバグは端末のバグでしかないこともある。

ヌフフ :)