Drawing D1 Histogram Colors on H4

 

Hello everyone!

This is my first post here. I need some help with the time-shifts.

I have constructed an indicator drawing Green and Red bars indicating buy-sell regions for externally specified TF. Im bad at timeframe changes that's why I need your help.

When the closing price for D1 comes, I need to draw the same color for all the H4 candles for that day. For example, if 29th of April 0:00 is closed at Red, I need the Red bar to be drawn on H4 for 0:00, 4:00, 8:00, 12:00, 16:00, 20:00 and 24:00 as well.

The same for H1. How can I do that?

 Thank you

 
datetime yesterday = iTime(NULL, PERIOD_D1,1);
int iYesterday = iBarShift(NULL, 0, yesterday);
double valueYesterday = ...
for(int iBar = iYesterday; iBar >=0; iBar--) buffer[iBar] = valueYesterday;
Reason: