How to get previous trading day hourly bars

Hello everyone,

I need to get closing prices of each hourly bars of yesterday. I tried it using TimeFrameSet(inHourly) in 5 min timeframe and using Day() != ref (Day(),-1) which is not detecting new day before completion of first hour. Any other way to do this? please help.

newday = Day() != Ref(Day(), -1);
bar1Price = ValueWhen(newday, C, 2); //previous day first bar
bar2Price = ValueWhen(newday, Ref(C,-6), 1);
bar3Price = ValueWhen(newday, Ref(C,-5), 1);
bar4Price = ValueWhen(newday, Ref(C,-4), 1);
bar5Price = ValueWhen(newday, Ref(C,-3), 1);
bar6Price = ValueWhen(newday, Ref(C,-2), 1);
bar7Price = ValueWhen(newday, Ref(C,-1), 1); //previous day last bar


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.