Errors, bugs, questions - page 1234

 
Tapochun:
Then this question. If the indicator is running on M15. A new candle is formed. When requesting data for M15 and M30, should they be available at the same time?

Yes.

After creating an indicator(including it in normal processing cycle) and getting into normal tick processing cycle (ontik), the data will be available with a high probability. But do not forget that there is no guarantee because of the possible history downloading for other symbols.

That is, always check the results of indicator data requests. If you request data in the ontika and it is not available, then exit immediately to check on the next tick.

Do not make the typical mistake "everything is always ready, I do not think about technical processes of data delivery and calculation, it should not concern me, I am always lucky". Always implement lazy initialisation logic and data control.

Be sure to test your programs on an empty chart base. It is usually enough to restart the terminal with a manually erased history database to get a variety of access errors by wrong index or division by zero.

If you got an m15 bar on a symbol, then there is definitely an m30 bar on the same symbol.

 
Renat:

Yes.

Another question. Does the BarsCalculated() function behave the same when called from an EA and indicator?
 
Tapochun:
Another question. Does the BarsCalculated() function behave the same when called from an EA and indicator?
What is wrong with it?
 
Renat:
What is wrong?

It's just that I've experimented with different information. As I understand it, they should work the same way. But they don't. As it's Sunday, there's no way to check in current time. But they work differently in the tester too. Here are two code samples. The gist is as follows. We are trying to get data from seven TFs. We start it (both advisor and indicator) not from the most significant TF. For example, from М15. If the current tick has synchronized the formation of a new candle and obtaining data on this candle via BarsCalculated() - then we record the number of calculated bars using BarsCalculated() and the time of the current candle. See details in the code.

The indicator.

First tick.

For each TF, a new candle is formed. But on TF M1, M5, M15, BarsCalculated() returns 0. But on TF M30, H1, H4, D1 it returns -1. Here we have a question, why does the function work differently? Accordingly, if we run it on the TF M30, for the TF M1, M5, M15, M30,BarsCalculated() returns 0. And, respectively, for the TF H1, H4, D1, it returns -1. From this we can conclude that for the higher TF the data is initially unavailable.

The second tick.

According to the code logic, synchronization, i.e. writing of parameters (all according to the logs of samples);

The third and the next tick.

We obtain a new bar by indicator for TF M30, H1, H4, D1. Although, the data seems to have already been obtained. And it turns out that the number on TF, greater than the current one, is greater by 1. Very strange behavior. In the future (using the current example) we will not be able to obtain synchronization.

Expert Advisor.

The first tick.

Synchronization is implemented immediately. The new value of BarsCalculated() is received synchronously with the formation of a new candle.

Second and subsequent ticks.

Logical behavior of the function. Everything is synchronized.

Run both examples by ticks in the tester, you will see for yourself. The current behaviour of the function is different for Expert Advisors and indicators. Also the data coming from the indicators is delayed for higher timeframes. Thus, I think thatwhen requesting data for M15 and M30 they will not be available at the same time.The actual data is definitely not!

If I am mistaken, please advise how to correctly obtain the indicator data from the older TF? Thank you.

 
//+------------------------------------------------------------------+
//| Search position of an element in a sorted list                   |
//+------------------------------------------------------------------+
CObject *CList::QuickSearch(CObject *element)
  {
   int      i,j,m;
   CObject *t_node=NULL;
//--- check
   if(m_data_total==0)
      return(NULL);
//--- check the pointer is not needed
   i=0;
   j=m_data_total;
   while(j>=i)
     {
      //--- ">>1" is quick division by 2
      m=(j+i)>>1;
      if(m<0 || m>=m_data_total)
         break;
      t_node=GetNodeAtIndex(m);
      if(t_node.Compare(element,m_sort_mode)==0)
         break;
      if(t_node.Compare(element,m_sort_mode)>0)
         j=m-1;
      else
         i=m+1;
      t_node=NULL;
     }
//--- result
   return(t_node);
  }
Standard CListlibrary
Why callCompare twice? It may be an expensive operation (if we need to check the equality of large objects, not the equivalence of some fields).
One can simply save the result after the first call ofCompare.
 
Renat:
Should I wait here for your answer? Or should I take it to the service desk?
 

Where are these icons coming from at the bottom of the chart?

There is no indicator on the chart, but the icons appear every time. I'm sick of deleting them. How do I turn this shit off? I can't find anything in the terminal settings about it.

 
meat:

Where do these icons at the bottom of the graph come from?

There's no indicator on the chart, but icons appear every time. I'm sick of deleting them. How can I turn this shit off? I can't find anything related to it in the terminal settings.

These are events from the "Calendar" tab. To delete: Right-click inside the Calendar tab -> Show on charts -> Delete all events.

P. S. And uncheck the "Auto update" option. Now new Calendar events will not be shown on the chart.

 
crOss:
Take any Expert Advisor (from MetaQuotes examples), run it under build 975 on a certain period and with the same parameters,
Obtain the results, i.e. yield curve chart and table of deals.


Now run the same EA under build 1010 on the same period and with the same parameters, you get completely different results...

P.S. Metatester is 32-bit

Which of the results is correct? In the 975 build or in the 1010 build?
 

Hi all) Please help me start the timer:

int OnInit()

{

bool setTimer=EventSetTimer(60);

Print("setTimer");

}

void OnTimer()

{

Print("Passing time");

}

Question: why doesn't it work? Blew my mind...(((.

Reason: