FORTS 助けてください - ページ 4

 
alexvd:
サービスデスクからソースコードを渡されましたね。最後のコードをTest()関数に書いてみてください。
Dima_S です。
マイケル、あなたの頑固さは理解できない。あるいはコピー&ペーストに問題があるのか)).私のコードを試せば、きっと楽しい驚きがあるはずです。
ミカラスは彼のレパートリーです。男は読書家ではなく、作家なのだ)
 
Dima_S:
マイケル、あなたの頑固さは理解できない。あるいは、コピー&ペーストに問題があるのか))私のコードを試してみてください - きっと心地よい驚きを感じることでしょう。
2015.03.26 18:12:41.068 Test_dima (MIX-6.15,M1) Get Bars failed RTS-6.15 Last error = 4401
2015.03.26 18:12:41.068 Test_dima (MIX-6.15,M1) Get Bars failed RTS-6.15 Last error = 4401
2015.03.26 18:12:41.068 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:41.698 Test_dima (MIX-6.15,M1) Get Bars failed Si-6.15 Last error = 4401
2015.03.26 18:12:41.698 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:41.858 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:41.858 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:41.978 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:41.978 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:43.230 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:43.230 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:45.134 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:45.134 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.244 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.244 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.314 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.324 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.324 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.334 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.334 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:46.664 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:46.664 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:47.704 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:47.704 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:47.834 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:47.834 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:47.854 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:47.854 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:47.974 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:47.974 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.014 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.014 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.044 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.044 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.304 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.304 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.324 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.324 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.344 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.344 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.364 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.364 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.394 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.394 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.404 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.404 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.474 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.474 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.494 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.494 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.514 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.514 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.524 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.524 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.564 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.564 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.594 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.594 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.614 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.614 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.634 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.634 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.654 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.654 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.674 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.674 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.724 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.724 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.754 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.754 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.774 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.774 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.794 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.794 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.814 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.814 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:49.854 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:49.854 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.374 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.374 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.484 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.484 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.504 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.504 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.524 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.524 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.554 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.554 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.574 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.574 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.604 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.604 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.634 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.634 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.664 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.664 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.684 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.684 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.764 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.764 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.784 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.784 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.824 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.824 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.834 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.834 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.854 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.854 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.874 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.874 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.884 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.884 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.934 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.934 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.954 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.954 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.974 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.974 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:50.994 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:50.994 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.004 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.004 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.034 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.034 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.064 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.064 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.094 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.094 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.104 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.104 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
2015.03.26 18:12:51.134 Test_dima (MIX-6.15,M1) Init OK.
2015.03.26 18:12:51.134 Test_dima (MIX-6.15,M1) Sorry! Get Bars failed.
 
Mikalas:

そんなはずはない。何らかのシステムエラーが発生しています。ターミナルでという意味です))。

まずはディスクから履歴データを削除して、端末を再起動してみてください。

 
Dima_S:

そんなはずはない。何らかのシステムエラーが発生しています。ターミナルでという意味です))。

まずはディスクから履歴データを削除して、端末を再起動してみてください。

あなたのコードでは、ResetLastError()の直後に、グローバル変数 is_failedのエラーをクリアする必要があります。そうでない場合は、エラーを検出すると、それに関するメッセージが表示されます。
 
Dima_S:

そんなはずはない。何らかのシステムエラーが発生しています。つまり、端末で))

手始めにディスクから履歴データを削除して、端末を再起動してみてください。

ありえない」ってどういうこと?

私がログを歪曲しているとでも言いたいのでしょうか?

 
komposter:
ミカラスは彼のレパートリーです。男は読者じゃない、作家だ)

こんぺいとう

わからないことや誤解があっても、誰もチュクチとは言いません。

なぜ、そうしなければならないのか?

 

友達になろうよ :)

alexvd:
ただ、ResetLastError()の直後に計算するあなたのコードでは、グローバル変数 is_failedのエラーをリセットする必要があります。そうでない場合は、エラーを検出すると、それに関するメッセージが表示されます。

しかし、すぐにではなく、負荷がかかったときに成功するのです。

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
//
bool is_failed = false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
  SymbolSelect( "MIX-6.15", true );
  SymbolSelect( "RTS-6.15", true );
  SymbolSelect( "Si-6.15", true );
//---  
  ResetLastError();
//---  
  int total_bars = Bars( "MIX-6.15", PERIOD_M1 );
  if ( total_bars > 0 )
  {
    total_bars = Bars( "RTS-6.15", PERIOD_M1 );
    if ( total_bars > 0 )
    {
      total_bars = Bars( "Si-6.15", PERIOD_M1 );
      {
        if ( total_bars > 0 )
        {
          Print( "Init OK." );
        }
        else
        {
          is_failed = true;
          Print( "Get Bars failed Si-6.15 Last error = ", string(GetLastError() ) );
        }
      }
    }
    else
    {
      is_failed = true;
      Print( "Get Bars failed RTS-6.15 Last error = ", string(GetLastError() ) );
    }
  }
  else
  {
    is_failed = true;
    Print( "Get Bars failed MIX-6.15 Last error = ", string(GetLastError() ) );
  } 
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
  ResetLastError();
//---  
  int total_bars = Bars( "MIX-6.15", PERIOD_M1 );
  if ( total_bars > 0 )
  {
    total_bars = Bars( "RTS-6.15", PERIOD_M1 );
    if ( total_bars > 0 )
    {
      total_bars = Bars( "Si-6.15", PERIOD_M1 );
      {
        if ( total_bars > 0 )
        {
          is_failed = false;
          Print( "Init OK." );
        }
        else
        {
          is_failed = true;
          Print( "Get Bars failed Si-6.15 Last error = ", string(GetLastError() ) );
        }
      }
    }
    else
    {
      is_failed = true;
      Print( "Get Bars failed RTS-6.15 Last error = ", string(GetLastError() ) );
    }
  }
  else
  {
    is_failed = true;
    Print( "Get Bars failed MIX-6.15 Last error = ", string(GetLastError() ) );
  } 
//---
   if ( is_failed )
   {
     Print( "Sorry! Get Bars failed." );
   }
   else Print( "Bingo! We done.");
//--- return value of prev_calculated for next call
   return(rates_total);
  }
 
MigVRN:

友達になろうよ :)

すぐにではありませんが、ダウンロードに成功した場合です。

それでいいんです。主義主張の問題ではありません。

 
alexvd:

そういうやり方もあるんですね。大したことではありません。

まあ、いいや...。だから、一度に全部できるんです。

ミカラス

最新のログから判断すると、このエラーは関数から3回返されています。初期化中に2回、OnCalculate() 中に1回 それで全てうまくいきました :)

 
MigVRN:

あ、そうか...。一度にできることがわかりました。

前回のログから判断すると、関数から3回エラーが返されています。初期化中に2回、OnCalculate()中に1回 ということで、動作しました :)

はい、でも本当にデータがなかったらどうするんですか?

では、どうするのか?サイクルとは、何回繰り返すことですか?