Easy. You can use a 'Formula' block. Create a variable to store the final result and then do this:

0_1587747432868_01.png

You can do the same for a min/max values within a period of candles.