Counting bars including weekends - page 8

 
Integer, Rena - you are being offered to pull a blank without much of a disguise. I don't want to fall for it.
 
Renat Akhtyamov:

here we go.

Time[i -(int)Fr]

The loop goes like this

for(i=100; i>=0; i--)

with analysis no less than zero this: i -(int)Fr

but the line to the future (at i<0) anyway - only by time or add weekend

although...

may be clue - how to shift to a negative number of bars, I do not remember

Now I made Time[(i+Fr)-x_bar] from the fractal point to the future,
now all lines are in the right places from the fractal plus the necessary bars ahead, but beyond the zero bar the lines do not rise anymore

 
forex2030:

Now from the fractal point to the future I made Time[(i+Fr)-x_bar],
now all lines stand on the needed places from the fractal plus the needed bars ahead, but lines do not stand behind the zero bar anymore

maybe try in this case to draw another buffer in present time and shift to the future?

https://docs.mql4.com/ru/customind/setindexshift

SetIndexShift - Пользовательские индикаторы - Справочник MQL4
SetIndexShift - Пользовательские индикаторы - Справочник MQL4
  • docs.mql4.com
При положительном значении изображение линии смещается вправо, при отрицательном - влево. Значение, рассчитанное на текущем баре, рисуется с указанным смещением относительно текущего бара.
 
Renat Akhtyamov:

maybe try drawing in the present tense and shifting to the future in this case?

Hmm, I'll have to try that.
I.e. I draw a line at the first point and shift by bars.
My line is not a buffer but an object, how do I organise this.

 
forex2030:

Hmmm, I'll have to try that.
I.e. I draw a line at the first point and shift by bars.
I don't have the line as a buffer but as an object, how do I organise this.

if an object, calculate the time of the future bar, taking into account the weekend

but if it is an indicator, then two buffers at >=0 and at <0

in the latter case, the command from the link above inside the loop

in this case, only the last line of the indicator for the second buffer and everything for the first buffer will be true

 

What's wrong with it? There is a start time, there is a current time.

int  Bars(
   string           symbol_name,     // имя символа
   ENUM_TIMEFRAMES  timeframe,       // период
   datetime         start_time,      // с какой даты
   datetime         stop_time        // по какую дату
   );
 
Renat Akhtyamov:

if an object, then calculate the time of the future bar taking into account the outputs
and if it is an indicator, then two buffers at >=0 and at <0
in the latter case, the command following the link above would be correct
in this case, only the last indicator line will be correct

OK, thank you.
I think that's enough for today, I will try it tomorrow, I will put the line in the buffer and shift it by bars forward.

Konstantin Nikitin:

What's wrong with it? There is a start time, there is acurrent time.

Doesn't work, I've tried it.

//+------------------------------------------------------------------------+ 
int NumData(datetime d_start,datetime d_stop){
   int bar=Bars(Symbol(),0,d_start,d_stop);
return(bar);}
 

forex2030:

It doesn't work, I've tried it.

As far as is clear from all your posts. You can't set the start time correctly for counting the bar gap.
It's a variant of what you need. Start of previous or current week/month/year

int  Bars(
   _Symbol,
   PERIOD_CURRENT,
   iTime(_Symbol, PERIOD_W1, 1),
   TimeCurrent()
   );
 
forex2030:

Alright, thanks.
That's probably enough for today, I'll try it tomorrow, I'll put the line in the buffer and shift it forward by bars.

It doesn't work, I've tried it.

The most interesting indicators, of course, are the ones that draw the future.

 
forex2030:

I have now done Time[(i+Fr)-x_bar] from the fractal point into the future,
now all lines stand on the correct places from the fractal plus the necessary bars ahead, but lines do not stand behind the zero bar

Make a check, if bar is negative, then add time to zero bar. You must write your own function MyTime(int bar), if the bar is less than zero, add time to the zero bar, otherwise use Time[].