I want a code for below strategy for scanning of stock

Conditions are :

1) For bull market : 

i. Scan the stock which has open price of 1 minute bar above the high of the day.

ii. And the last price should be above EMA 14 days period.

iii. MACD shows buy signal.

2) For bear Market

i. Scan the stock which has open price of 1 minute bar below the low of the day.

ii. And the last price should be below the EMA 14 days period.

iii. MACD shows sell signal.

As per the above condition

Buy Script:

SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
LAST>HHV(25) AND LAST>EMA(CLOSE,14) AND
CROSSOVER(A, B) = TRUE

Sell Script:

SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)
LAST>LLV(25) AND LAST<EMA(CLOSE,14) AND
CROSSOVER(B, A) = TRUE