Code needed for Pi - Crossover strategy

I wants signals for below conditions-

  1. Buy- When current candle closes above High of previous candle and if current candle close is greater than candle open.

Sell- When current candle closes below previous candle and if current candle close is lesser than open.

  1. Buy- If price crossover greater than highest high of previous 30 candles

Sell- If price crossover lesser than lowest low of previous 30 candles.

1. 

Buy-
CLOSE > REF (HIGH, 1) AND CLOSE > OPEN

Sell-
CLOSE < REF (LOW, 1) AND CLOSE < OPEN

2.

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

Sell-
CROSSOVER(REF(LLV(30),1),CLOSE)
1 Like