HHV and LLV of Specific Time range in Intraday

Hi,
I have taken this code from following link.

But when i add Addcolumn, it is showing high and low values for every 5 minute candle.
What is missing in the attached code.
I just want to get the HHV and LLV value of the specified intraday time range of P11 and P12.

ppl = ParamToggle("IB_LEVELS","Off|On",1); 
pplxt = ParamToggle("IB _LEVELSExtn","Off|On",0); 
P11   = Param("IB  Start Time",091500, 0 , 235959, 1 ) ;  
 P12   = Param("IB   END Time",101500, 0 , 235959, 1 ) ; 
 START = (TimeNum()>= P11); 
 END   = (TimeNum()<= P12); 
 ZONE  = START AND END; 
 ST    = (TimeNum()>= P12); 
 NewTime = ZONE!= Ref(ZONE, -1); 
 highestoftheday = HighestSince(NewTime,H,1); 
 Lowestoftheday  = LowestSince(NewTime,L,1); 
 IBHigh   = ValueWhen(ZONE,highestoftheday,1); 
 IBLow    = ValueWhen(ZONE,lowestoftheday,1);

Any help would be appreciated.

Thanks,

Gloria Filamino

@Gloriafilamino this article might help,

http://www.amibroker.com/kb/2015/02/02/high-low-of-certain-hours-of-the-day/

And an example

tn = TimeNum(); 

StartTime = 093000; 
EndTime   = 101500; 

// these conditions are true when TimeNum of the bar equals startime/endtime 
StartBar = tn == StartTime; 
EndBar = tn == Endtime; 

// on the end bar we read the value of highest high since the start bar 
myH = ValueWhen( EndBar, HighestSince( StartBar, High ) ); 


Filter=1;
AddColumn(High, "High");
AddColumn(myH, "myH");

Produces this Exploration on 5 minute bars,
image

2 Likes

Then simply add a Filter

ppl = ParamToggle( "IB_LEVELS", "Off|On", 1 );
pplxt = ParamToggle( "IB _LEVELSExtn", "Off|On", 0 );
P11   = ParamTime( "IB Start Time", "09:15:00" );
P12   = ParamTime( "IB END Time", "10:15:00" );

tn = TimeNum();

START = tn >= P11;
END   = tn <= P12;
ZONE  = START AND END;
ST    = tn >= P12;
NewTime = ZONE != Ref( ZONE, -1 );
highestoftheday = HighestSince( NewTime, H, 1 );
Lowestoftheday  = LowestSince( NewTime, L, 1 );
IBHigh   = ValueWhen( ZONE, highestoftheday, 1 );
IBLow    = ValueWhen( ZONE, lowestoftheday, 1 );

Filter = ZONE;

//Or
// Filter = ST;

//Or whatever filter
// Filter = ....;

AddColumn( IBHigh, "High of time window", 1.2 );
AddColumn( IBLow, "Low of time window", 1.2 );

2 Likes

Thanks a Lot…
I didn’t notice the explorer results closely.It was my Mistake.