VWAP based code to backtest the strategy

Can anyone help me in providing code to backtest the strategy in Pi for VWAP based entry & exit.

Buy on 15 timeframe when
VWAP < CLOSE AND
OPEN < CLOSE
Sell on 15 timeframe when
VWAP > CLOSE AND
OPEN < CLOSE