Zerodha PI Code

I want to know the code for this strategy!

  1. to mark the high and low of the first candle of the day! (30 mins candle in 6 different candles of 5 mins )
  2. Buy alert when the next 5 min candle closes above the high of the first 30 min candle
  3. Sell alert when the next 5 min candle closes below the low of the first 30 min candle

Put a stop loss for buying and selling for the same!

can u please update both the codes individually so I can backtest it too!