Defining PDH and PDL

Can someone please help me how to define Previous Day High and Previous Day Low. For Example, If I have to define Nifty Futues breaks PDH then trigger for Buy. Please codify this

In Ujjwal’s image, CLOSE is being compared with yesterday’s High. his approach is correct. His suggested code will trigger it only if 5min’s candle closes above PDH. But looks like you want to enter as soon as PDH is broken and NOT when candle closes above PDH. In that case just use LTP instead of close. Otherwise, his suggestion is apt.

I haven’t coded this before, so validate at end. Also @Ujjwal may be able to guide better on this.