Stcok Screener for my logic

I want stock screener / scanner for my following logic

Opening Range breakout start : 9.15 am
Opening Range breakout end : 9.45 am

Stock Selection as follows

  1. Top performing index at 9.40 am

( pickup stock with top gainer 1, top loser 1 )

  1. Worst performing index at 9.40 am

( pickup stock with top gainer 1, top loser 1 )

  1. OPEN = HIGH Top One stock at 9.40 am

  2. OPEN = LOW Top One stock at 9.40 am

  3. Top Gainer One stock at 9.40 am

  4. Top Loser One stock at 9.40 am

we get 8 stocks, for the trading.

Strict Rules :

First entry gives profit,there wont be
no re entry on that particular stock
for the entire day

take double qty, if first entry failed
(* optional * )

No re entry in same side.

buy entry :

when ORB high (9.15-9.45) breaks on candle closing bias, take a buy
in next candle open price with stoploss 1 percent below entry price.

target 1 % or keep till 3.15 pm


sell entry :

when ORB low (9.15-9.45) breaks on candle closing bias, take a sell
in next candle open price with stoploss
1 percent above entry price

target 1 % or keep till 3.15 pm


I did it but it will not work on volatile day like today 13June 2017.

It works only in Trending days.

Can u please share the code for the same !