Pi code for backtesting

can anyone tell me pi code for backtesting
my criteria is this -
long above previous day high
short below previous day low
gap-up short below previous day high
gap-down buy above previous day low
stop loss - 1% of the scrip
target - auto square off

Your Conditions requires referencing to Previous Days candle Values, Which is not supported on Tradescript on Pi.

Please Read the FAQ:

Can we do the coding for Range breakout strategy for zerodha pi