FORTS Please help - page 4

 
alexvd:
The service desk gave you the source code. Try to put your last code into Test() function.
Dima_S:
Michael, I do not understand your obstinacy. Or you have copy/paste problems)). Try my code and you'll be pleasantly surprised.
Mikalas is in his repertoire. A man's not a reader, he's a writer.)
 
Dima_S:
Michael, I don't understand your stubbornness. Or have a problem with copy/paste)) Try my code - you will be pleasantly surprised.
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:

That can't be right. You have some kind of system error. I mean in terminal)).

Try deleting the history data from the disk and restarting the terminal first.

 
Dima_S:

That can't be right. You have some kind of system error. I mean in terminal)).

Try deleting the history data from the disk and restarting the terminal first.

In your code, just after ResetLastError() you must clear error in global variable is_failed. Otherwise, once you have caught an error you will get a message about it
 
Dima_S:

That can't be right. You have some kind of system error. I mean, in the terminal))

Try deleting the history data from the disk and restarting the terminal for starters.

What do you mean "it can't be"?

Are you implying that I'm distorting logs?

 
komposter:
Mikalas is in his repertoire. A man's not a reader, a man's a writer.)

komposter!

When you don't understand or misunderstand something, no one calls you a Chukchi.

Why should they?

 

Let's be friends :)

alexvd:
Just in your code in it calculate immediately after ResetLastError() you must reset the error in global variable is_failed. Otherwise once you have caught an error you will get a message about it

But not immediately - but at successful load.

#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:

Let's be friends :)

Not right away - but with a successful download.

That's all right. It's not a matter of principle.

 
alexvd:

You can do it that way. It's not a big deal.

Oh, well... So you can do it all at once.

Mikalas:

Judging by your latest logs, the error is returned by the function 3 times. 2 times during initialization and 1 time inOnCalculate(). So everything works :)

 
MigVRN:

Oh, right... It turns out that you can do it all at once.

Judging by your last logs, error is returned by function 3 times. 2 times during initialization and 1 time inOnCalculate(). So it worked :)

Yes, but what if there really is no data?

What then? Cycle? with how many iterations?

Reason: