How do I find small timeframes inside a bigger timeframe in the past?

 

Suppose an old bar, say index 15 is bullish. The timeframe is 1H. I want to probe for the state (bullish/bearish) and possibly other data (iopen, iclose, EMAs etc.) on each 15M bar that existed inside that one bar when it happened.

How can I achieve that?


TIA

 
whoowl:

Suppose an old bar, say index 15 is bullish. The timeframe is 1H. I want to probe for the state (bullish/bearish) and possibly other data (iopen, iclose, EMAs etc.) on each 15M bar that existed inside that one bar when it happened.

How can I achieve that?


TIA

Use iBarShift with the time of the H1 bar. That will find the first M15 bar.

Then you could theoretically use the shift and the following 3 M15 bars but that is assuming that there are 4 M15 bars that relate to the H1 bar. 

So you should check that all 4 bars have the same hour. You could check this by using iBarShift again with each time of the M15 bars and making sure that it takes you to the original H1 shift.

 
whoowl:

Suppose an old bar, say index 15 is bullish. The timeframe is 1H. I want to probe for the state (bullish/bearish) and possibly other data (iopen, iclose, EMAs etc.) on each 15M bar that existed inside that one bar when it happened.

How can I achieve that?


TIA

use the H1 bar time and the third form of copyrates, this will allow you to specify a start time (H1 bar time) and end time (H1 bar time + 1 hour) that you require the smaller timeframe bars for

https://www.mql5.com/en/docs/series/copyrates

Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
CopyRates - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Many thanks to you both.
Reason: