Questions from Beginners MQL5 MT5 MetaTrader 5 - page 76

 
FinEngineer: Only one error remains 2012.12.22 00:56:44 Pair_delta_RSI (EURGBP,M1) Not all data of RSI1_Handle is calculated (-1bars ). Error4806

This error does not come out during compilation, but when I attach the indicator to the chart, or when I change the timeframe.

Does this error message play all the time, or does it disappear with time?

 
Guys! Can the MT5 be connected to any DC?
 
net:
Guys! Can MT5 be connected to any brokerage company?

No. Trading through MT5 is possible through the broker that provides the possibility to trade through this platform, such as VTB24 and Alfa forex.

Условия для трейдеров
  • www.alfa-forex.ru
Если у вас уже есть опыт работы на валютном рынке, то вы по достоинству оцените преимущества работы с Альфа-Форекс Самые узкие спреды на рынке: EUR/USD — от 0,7 пункта Отсутствие минимального депозита Быстрый ввод и вывод средств Исполнение ордеров без проскальзываний и реквот Альфа-Форекс входит в банковскую группу в составе Консорциума...
 
Yedelkin:

Does this error message play constantly, or does it disappear over time?

Once, when I attach the indicator to the graph...
 
Yedelkin:

Does this error message play all the time, or does it disappear with time?

2012.12.22 11:40:32 Pair_delta_RSI (EURGBP,M1) array out of range in 'Pair_delta_RSI.mq5' (92,37)
it turns out this error appears too... i.e.... there are two errors...
 
Yedelkin:

Does this error message play constantly, or does it disappear over time?

Tried it in alphaforex, just tried it in alpari, same error...
 

FinEngineer:

Yedelkin: Does this error message play all the time, or does it disappear over time?

Once, when I attach the indicator to the chart...

Then you are doing fine. When you just attach the program to a chart or change timeframe, there is no new calculated data for RSI indicator or any other in the terminal. And the terminal needs some time to calculate the necessary indicator buffers. Look carefully at your code (I understand that it is written according to someone else's sample, but nevertheless): When the calculated data for RSI are not enough, the function OnCalculate() stops working ('return(0);') and waits for a new tick. As soon as on the next tick the indicator buffers for RSI are calculated, your indicator starts to work in normal mode. Which it does, judging by what you say.

You can also insert the check with BarsCalculated() into OnInit() function - then the error will occur very rarely (if at all). An example is given in the description of the BarsCalculated() function.

 
FinEngineer: 2012.12.22 11:40:32 Pair_delta_RSI (EURGBP,M1) array out of range in 'Pair_delta_RSI.mq5' (92,37)
it turns out this error also appears... i.e. there are two errors...
Concerning this error I have already written to you yesterday. (Don't forget to insert the code correctly :) )
 
Yedelkin:
About this error I already wrote to you yesterday. (Don't forget to insert the code correctly :) )

Removed the piece of code responsible for insufficient data (below)

int calculated=BarsCalculated(RSI1_Handle);

if(calculated<rates_total)

{

Print("Not all data of RSI1_Handle is calculated (",calculated, "bars ). Error",GetLastError());

return(0);

}

calculated=BarsCalculated(RSI2_Handle);

if(calculated<rates_total)

{

Print("Not all data of RSI2_Handle is calculated (",calculated, "bars ). Error",GetLastError());

return(0);

Can you tell me how to mark code fragments in the message?

Now an error is coming out:

2012.12.22 15:14:00 Pair_delta_RSI (EURGBP,M1) Getting RSI1 is failed! Error4806

 
FinEngineer: Please advise how to select code snippets in the message?

Insert code correctly.

FinEngineer : Removed the piece of code responsible for insufficient data (below)
   int calculated=BarsCalculated(RSI1_Handle);
   if(calculated<rates_total)
     {
      Print("Not all data of RSI1_Handle is calculated (",calculated,"bars ). Error",GetLastError());
      return(0);
     }
   calculated=BarsCalculated(RSI2_Handle);
   if(calculated<rates_total)
     {
      Print("Not all data of RSI2_Handle is calculated (",calculated,"bars ). Error",GetLastError());
      return(0);

It worked fine there, that "piece of code which is responsible for insufficient data". And correctly reported that at first tick data for RSI is not yet calculated by the terminal. If you do not like to receive error messages, try to do as above, namely to check for calculated data not only in OnCalculate(), but also in OnInit(). In other words, try to wait for the data calculation for selected technical indicators in OnInit() and then move to the ticks processing in OnCalculate() when the data for indicators is guaranteed to be calculated.

Adding. In the end, the removal of a part of the check code does not increase the number of calculated indicator data :)

Reason: