Counting bars including weekends

 

There are two points t1 and t2, between them there are 25 bars,
How do I know how many outputs there were between points, e.g. on D1, so that I can add them to the required bars?

 
forex2030:

There are two points t1 and t2, between them there are 25 bars,
how do i know how many days off there were between the two points, e.g. on D1, so i can add them to the required bars?

(Time[t2]-Time[t1])/(24 * 60 *60) = number of calendar days

t2-t1 = number of daily bars

so their difference = number of days off (including holidays and force majeure)

 
forex2030:

There are two points t1 and t2, between them there are 25 bars,
how do i know how many outputs there were between the two points on e.g. D1 and then add them to the required bars?

Why add them to the "right bars" ?

 
Алексей Тарабанов:

Why add them to the "right bars"?

The line becomes the wrong bar because of the calculation without taking the weekend into account


 
Maxim Kuznetsov:

(Time[t2]-Time[t1])/(24 * 60 *60) = number of calendar days

This is how I got the number of bars for the period, but I didn't take weekends into account.

If I add the needed number of bars to the first point, I get the wrong date where I should put the line.
For example the first point is the 5th day + 12 bars = 17th of the month and with days off it should be the 21st.
Or how can I add visible bars on the chart to the first point?

 

It's not easier to navigate by bar time.

 
Konstantin Nikitin:

Isn't it easier to orientate by bar time.

How do I know that in 12 bars from the first point to the second point there were 4 days off and then add to 12+4 and then I get the right date

 
forex2030:

This is how I got the number of bars for the period, but I didn't take the weekend into account.

If I add the required number of bars to the first point, I get the wrong date where I should put the line.
For example the first point is the 5th + 12 bars = 17th of the month and it should be the 21st with taking into account weekends.
Or how can I add visible bars on the chart to the first point?

Do you set the line by dates or by bars?

 
Алексей Тарабанов:

Are you setting the line by date or by bar?

By date.

ObjLine("VLine",Time[j]+PeriodSeconds()*Pp,Price,Lime);

I add bars to the first point

 
forex2030:

By date

I add bars to the first point

At the beginning of OnTick:

If( LastBottomTime ) LastBottomBar=iBarShift(NULL,0,LastBottomTime);

At the end:

if( LastBottomBar < 1 ) LastBottomTime=0; // Last fractal time

else LastBottomTime=Time[LastBottomBar];

Naturally, the Lasts are all global.
 
Алексей Тарабанов:

At the beginning of OnTick:

if( LastBottomTime ) LastBottomBar=iBarShift(NULL,0,LastBottomTime);

At the end:

if( LastBottomBar < 1 ) LastBottomTime=0; // Last fractal time

else LastBottomTime=Time[LastBottomBar];

Something I do not understand, what will it give me?

Maybe some sort of enumeration of days from point to point and if for the period day = 6 or 0 then day++;