I'm trying to get the 30 mins OI from 9:15 to 9:45 in Intraday; I'm getting results for 1 hour value with the following code. Need the same working for 30 mins from open. Kindly help!
_SECTION_BEGIN("OI For 30 mins");
starttime = ParamTime( "Start Time", "09:15" );
endtime = ParamTime( "End Time", "09:45" );
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == starttime, BarIndex());
points = ValueWhen(TimeNum() == endtime, close)- TimeFrameGetPrice("O",inHourly,0);
TodayOI=Sum(OpenInt,Bars_so_far_today);
OI4time=IIf (BarIndex() >= StartBar AND TimeNum() <= endtime, TodayOI,Null);
Plot (OI4time, "Total OI 4 time",colorYellow,stylehistogram);
Filter = TimeNum() == endtime;
AddColumn(OI4time,"OI for 1st 1 Hour",1);
_SECTION_END();
_SECTION_BEGIN("OI For 30 mins");
starttime = ParamTime( "Start Time", "09:15" );
endtime = ParamTime( "End Time", "09:45" );
Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == starttime, BarIndex());
points = ValueWhen(TimeNum() == endtime, close)- TimeFrameGetPrice("O",inHourly,0);
TodayOI=Sum(OpenInt,Bars_so_far_today);
OI4time=IIf (BarIndex() >= StartBar AND TimeNum() <= endtime, TodayOI,Null);
Plot (OI4time, "Total OI 4 time",colorYellow,stylehistogram);
Filter = TimeNum() == endtime;
AddColumn(OI4time,"OI for 1st 1 Hour",1);
_SECTION_END();