AFL Coding - Buy / Sell Coding Help

Can someone help me adding buy and sell condition to this AFL.

Buy Condition :- IF Price closes above PDL from below after 9:30 am

Sell Condition :- IF Prices closes below PDH from above after 9:30 am

SL are Few points below PDH and PDL

To Clarify this is my complete requirement

I am looking for a failed breakout strategy where either the day opens below Previous day high.... Candles crossses above PDH during the day but anytime after 9:30 it comes and closes below PDH. I want the sell signal to be generated on the break of low of the candle which closes below PDH with a target profit till PDL and Stop few points above PDH or if it is a gapup then once crosses below PDH after 9:30 a sell signal should be generated and vice versa for gapdown

Appreciate if someone can help me in building the buy and sell condition in the attached AFL.... Appreciate your support!

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat(EncodeColor( colorGold) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates);

Plot( C, "Price", colorDefault, styleCandle );

PDH = TimeFrameGetPrice("H",inDaily,-1);
PDL = TimeFrameGetPrice("L",inDaily,-1);

Plot(PDH,"Upper",colorGreen,styleLine | styleThick);
Plot(PDL,"Lower",colorRed,styleLine | styleThick);

Check out here
http://www.amibroker.com/kb/2014/11/28/how-to-restrict-trading-to-certain-hours-of-the-day/

Thank you for posting the thread , the problem is not defining the timing function. The challenge I am facing is to define the buy and sell condition because that need to defined as a failed breakout . Candle Crosses over Previous Day High but failed to sustain above that and then come below Previous day high there I want sell to be initiated similarly for Buy condition... Hope this clarifies my requirement. Appreciate your support