Problem with dawing bars for non-current TimeFrame

 

Hi!                                                                                                                 (Im new to this forum and dont know if its ok to add new threads for every new question).

 I need to draw a "myHistogram" indicator for H4 when Im on D1 chart. How can I achieve this? Every 4th bar must be drawn only. So iBarShift does not help.

Any suggestions?

Thanks 

 
There are 6 bars on the H4 for every D1. You have to choose which H4 bar value you want displayed.
datetime D1time = Time[i];
int iH4 = iBarShift(NULL, PERIOD_H1, D1time);           // Choose first 4 hours of the day
int iH4 = iBarShift(NULL, PERIOD_H1, D1time + 4* 3600); // Choose second 4 hours of the day
buffer[i] = yourH4value(iH4); // such as iHigh(NULL, PERIOD_H4, iH4)
 
WHRoeder:
There are 6 bars on the H4 for every D1. You have to choose which H4 bar value you want displayed.



Thanks a lot.

My close prices for D1 are at 0:00 everyday. So I need 

int iH4 = iBarShift(NULL, PERIOD_H1, D1time + 24 * 3600); 

This is clear to obtain the values but will the chart graph the bars only for these values? I need missing values to be empty. For example as Im obtaining the results for only 0:00 for H4 scale as well, I need 4:00, 8:00...16:00, 20:00 to be empty.

 

Thanks again 

 

There is only ONE D1 bar. There is no missing values to be empty.

If you want yesterdays close price on the D1 - use Close[1]

 
WHRoeder:

There is only ONE D1 bar. There is no missing values to be empty.

If you want yesterdays close price on the D1 - use Close[1]


Thank you. And what if Im on H1?

 In this case there are only 6 values to be taken into account while 18 are to be ignored and not drawn...

Reason: