This Amibroker AFL code looks for cases where first 15 minute candle of the day has broken previous day high or low. It gives a buy signal if close of the first candle is also greater than EMA(20) and EMA(40).
As of now, it does not ask for any parameter but those can be introduced, if needed. This code can also be easily changed to accommodate 5 minute candle.
Please note this is a strategy on its own and if run in exploration window on or after 9:30AM, then it will provide a list of symbols for which these conditions are satisfied. Take the trade when this first candle is breached.
_SECTION_BEGIN("PDHBreakOut-Scanner");
TimeFrameSet(in15Minute);
//TimeFrameSet(inDaily);
xH = TimeFrameGetPrice("H",inDaily,-1);
xL = TimeFrameGetPrice("L",inDaily,-1);
Session= int(TimeNum()/100) == 915;
//Filter=Session;
TimeFrameRestore();
TimeFrameSet(in15Minute);
Buy = (C>xH && O<C && C>=EMA(C,20) && C>=EMA(C,40)) AND Session;
Sell= (C<xL && O>C && C<=EMA(C,20) && C<=EMA(C,40)) AND Session;
TimeFrameRestore();
//_TRACEF("xL=%f,xH=%f, c5=%f,O5=%f",xL,xH,C5,O5);
//printf("xL=%f,xH=%f, c5=%f,O5=%f",xL,xH,C5,O5);
_SECTION_END();