Can you code with highest high price and lowest low price

please code below condition

Buy : Price crossover > Highest high of previous 30 bars

 Sell : Price crossover < Lowest low of previous 30 bars.

Buy:

CROSSOVER(CLOSE,REF(HHV(30),1))

Sell:

CROSSOVER(REF(LLV(30),1),CLOSE)