Counting bars including weekends - page 5

 
it's easier to redraw the lines on a new day and not have to worry about it)
 
Aleksey Nikolayev:

There will certainly be. But, for example, its high-low will stand out from the rest and there will always be a question - is it a holiday or dropped minute bars? It is not very clear how to automate such checks.

Throughan economic calendar, for example

there's both the closing time and the day

 

Trying this way came up with the 2+2=4 style, but something is wrong again, tweak

//+------------------------------------------------------------------------+ 
//| Рассчитывает бары от 0 до места установки                              | 
//+------------------------------------------------------------------------+ 
datetime NewBar(int i,datetime d_start,int x_bar){
   int n_bar=0;
   datetime t_bar=0;

//Тут определяется кол-во баров от 0 до первой точки минус бары сдвига 25 - 12 = 13 место от 0 на 13 баров точка два верная
      n_bar=iBarShift(Symbol(),0,d_start)-x_bar;

//Если отрицательное значение, то сдвиг будет от бара 0 в будущее
   if(n_bar<0) t_bar=Time[i]+PeriodSeconds()*MathAbs(n_bar);

//Если положительное значение, то сдвиг будет от бара 0 назад по истории
         else  t_bar=Time[i+n_bar];

return(t_bar);}
 

Is there an error in the line drawing code?

I've already sawed the graph with verticals in different ways, and I don't seem to have had any problems with it.
 
Renat Akhtyamov:

viathe economic calendar, for example

There are both closing times and the day

Does the calendar work in the tester?

 
Aleksey Nikolayev:

does the calendar work in the tester?

you can do it if you just download the history for it
 
Renat Akhtyamov:

and there is no error in the line drawing code?

No errors.

I've already sawed the graph with verticals in different ways, and I don't seem to have had any such problems.

I also did not observe this before or did not pay attention,
I also did not see it before or did not pay attention to it, but when I looked at H4 and D1 I knew where the lines should be, so I saw this divergence and now I am trying to solve it.


 
Aleksey Nikolayev:

There will certainly be. But, for example, its high-low will stand out from the rest and there will always be a question - is it a holiday or dropped minute bars? It's not very clear how to automate such checks.

I've moved away from the discussion above:"surely there is always a correspondence that there is a Sunday before a Monday?"

then I'll have to discuss with you.... and for sure the daily bar on the chart belongs to the date the day of which is the opening day of the bar....

)))

Alas, with programming it all depends on the formalization of the task and the purpose of use

i have in the second example considered the wish to make a correction to take into account the bars where the "day begins" not with 0h 00m , i checked it a couple of times - it works

what are your objectives?

SZZ: The historical data is a total mess, time on brokers' servers is translated by whoever thinks up it, imho, it's quite a "story") )))

 
Igor Makanu:

I left above the discussion:"but surely there is always a correspondence that before Monday comes Sunday?"

then I will have to discuss with you.... and for sure the daily bar on the chart belongs to the date the day of which is the opening day of the bar....

)))

alas, with programming it all depends on the formalization of the task and the purpose of use

In the second example I took into account the wish to make an adjustment, to consider the bars with the "day beginning" not at 0:00 a.m. I checked it a couple of times and it worked.

what are your purposes?

ZS: With the historical data it is a mess, the time on the servers of brokers is translated by whoever thinks up how, imho, this is quite a "story". )))

also did

i.e. the beginning of the day may start not at 00:00 but at 00:15

of course this is the reason why the topic starter searches for days off

But that's for naught, 100%.

 
Renat Akhtyamov:
can be done, if only the history for it is downloaded

"can be done" and "works" are two big differences. In any case, this will only partially solve the problem of separating legitimate missing quotes from illegitimate ones.

Reason: