What techniques and methods can be used in multiframe indicators to prevent getting a pretty picture due to peeking into the future on higher TFs ? - page 4

 
Dmitry Fedoseev #:

I think so. Only I would add 1 to bar_Shift_W1 to make it a formed bar.

Why refer to the previous weekly bar if it takes the opening price?

 

in personal libraries, when accessing timeseries and similar data, the bar number "defaults" to 1. Although the actual one is 0.
just the indicator values on the unclosed bars are not fully defined.

double daily_macd=D1[MACD];  // это MACD на вчера

you can yank D1[MACD][0], but that's wrong, the last day has a lower number of hours than the others, it's a bit not MACD at all.

In general, we should consider adding 1 to the indices when referring to other timeframes, so as not to include the "unclosed bar" in them.
In OnCalculate of indicators not to cheat yourself - address through time, i.e. first obtain TF index through time and add 1.

If we don't do so, the picture turns out very beautiful, but absolutely useless

PS/ but this doesn't get to our codospamer and codobase is full of curves multitfs.

 
PapaYozh #:

Why refer to the previous weekly bar if it takes the opening price?

Yeah, didn't pay attention, then don't 1.

Better not to bother with the opening price at all.

 
Dmitry Fedoseev #:

I think so. Only add 1 to bar_Shift_W1 to have a bar formed.

So you think that the open price of the current bar of the older TF cannot be used?

 
Dmitry Fedoseev #:

Yes, didn't pay attention, then don't 1.

Better not to bother with opening prices at all.

What do you mean by not bothering? What if I need the open price of the current bar of the major TF to calculate the signal?

 
Maxim Kuznetsov OnCalculate of indicators not to cheat yourself - address through time, i. e. first obtain TF index through time and add 1.

If we don't do so, the picture turns out very beautiful, but absolutely useless

PS/ but our codospammer doesn't get this and codobease is full of multitf curves.

So you think that the opening price of thecurrent bar of the older TF cannot be used? Add 1 to what? To get what? I know the concept of the bar index but I am not familiar with the concept of the TF index.

 
khorosh #:

So you think that the opening price of thecurrent bar of the older TF cannot be used? Add 1 to what? To get what?

let's assume the working timeframe is M5, it is 10:38, we need something at 9:17 of H1

To get the H1 data, we take iBarShift(_Symbol,PERIOD_H1, "9:17") and add 1, we get the index of the H1 bar already closed by the time 9:17. Using this index, we can calculate the data of the bar and indicators.

 
Maxim Kuznetsov #:

Let's assume the working timeframe is M5, it is 10:38, we need something at 9:17 of H1

to get the H1 data, we take the iBarShift(_Symbol,PERIOD_H1, "9:17") and add 1, we get the index of the H1 bar already closed by the time 9:17. Using this index, we can calculate the data of the bar and indicators.

Let's be more specific, we are speaking about a multiframe indicator and we are in the loop of searching the index of the bar of the current low TF. And we do not use constants of "9:17" type there.
And anyway, what unit are we talking about? Do indices of two adjacent bars of the major TF differ by one? After all, when we are inside the loop of the index of the bar of the current smallest TF, we express the index of the bar of the older TF through the index of the bar of the current smallest TF. Therefore, adding 1 will not give the index value of the previous bar of the older TF. We should not add 1, but the number that equals the number of barsof the current low-end TF contained inside the bar of the high end TF.

 
khorosh #:

Let's be more specific, we are talking about a multiframe indicator and we are inside the loop of the bar index of the current low TF. And we do not use constants like "9:17" there.
And anyway, what unit are we talking about? Do indices of two adjacent bars of the major TF differ by one? After all, when we are inside the loop of the index of the bar of the current smallest TF, we express the index of the bar of the older TF through the index of the bar of the current smallest TF. Therefore, adding 1 will not give the index value of the previous bar of the older TF. We should not add 1, but the number that equals the number of bars ofthe current low TF contained inside the bar of the high TF.

It's just that no one can make sense of it.
Illustrate

In brief, the pullback of a higher one will be visible on the lower timeframe. And this is a different direction of the trade

Only the desire to have the whole price movement can inspire to create such a multitemporal indicator.

The trouble is that even on one TF it doesn't work so well for some people
 
khorosh #:

What do you mean by not bothering? What if I need the open price of the current bar of the major TF to calculate the signal?

If it is the opening price that is needed, that is another matter.

Reason: