Please give me a code for the following

All bars are successive bars.

Condition 1:

bull-bear-bull-bear (or) bear-bull-bear-bull;

Condition 2:

if condition 1 is satisfied, buy signal should be created when the price again touches high of the four candles and sell signal should be created when the price again touches low of the four candles.

Condition 3:

If condition 1 happens again without condition 2(i.e Without again touching high or low ), take the new order(Bull-bear-bull-bear (or) bear-bull-bear-bull) to execute condition 2.

hElLO tRaDeR,

BUY SCRIPT:

((REF(CLOSE,4) > REF(OPEN,4) AND 
REF(CLOSE,3) < REF(OPEN,3) AND 
REF(CLOSE,2) > REF(OPEN,2) AND 
REF(CLOSE,1) < REF(OPEN,1)) OR 
(REF(CLOSE,4) < REF(OPEN,4) AND 
REF(CLOSE,3) > REF(OPEN,3) AND 
REF(CLOSE,2) < REF(OPEN,2) AND 
REF(CLOSE,1) > REF(OPEN,1)) AND 
HIGH = HHV(5) 

SELL SCRIPT:

((REF(CLOSE,4) > REF(OPEN,4) AND 
REF(CLOSE,3) < REF(OPEN,3) AND 
REF(CLOSE,2) > REF(OPEN,2) AND 
REF(CLOSE,1) < REF(OPEN,1)) OR 
(REF(CLOSE,4) < REF(OPEN,4) AND 
REF(CLOSE,3) > REF(OPEN,3) AND 
REF(CLOSE,2) < REF(OPEN,2) AND 
REF(CLOSE,1) > REF(OPEN,1)) AND 
LOW = LLV(5) 

Hi, Is this for Pi ?

yes, this is for Pi