Multi timeframe through a shift calculation?

 

Hi everyone,

I am trying to get the readings of an H4 indicator through a H1 one. I appreciate the existence of MTF indicators, but think that there should be a more appropriate way to get the indicator readings at a different timeframe. I mean, something of the sort (this code does not do the work, unfortunately, as compared to the readings of a real #MTF indicator):

int shift4H = shift/4+1;

while(Time[shift]>Time[shift4H]) {

offset4H--;

}

double value = iCustom(Symbol(),PERIOD_H4,..., offset4H);

The benefits of the above code include fewer calculations and the possibility to use it with non-custom indicators (for example, the built-in Stochastic Oscillator/CCI/RSI, etc.). It would also make the creation of multi timeframe-aware indicators much easier and effortless, I guess.

But unfortunately I cannot get it to work...

Anyone tried to do what I am? Please share your experience!

 

Try this :

shiftH4 = iBarShift(Symbol(), PERIOD_H4, Time[shift], false);

value = iCustom(Symbol(),PERIOD_H4,..., shiftH4);

 

That's exactly what I was trying to do. Really precious piece of knowledge. Thank you so much for your help!

Take care.

Reason: