I need traderscript code for hour chart RSI Trend change

BUY Setup

   When the first  lower  low  RSI also lower of low , second  lower  low  RSI is Higher low

   I .e -  first  lower  low  price = 240  RS= 10  second  lower  low  price=238  RSI =14

SELL Setup

   When the first  Higher high  RSI also higher high , second  higher high  RSI is lower high

      I .e -  first  Higher high  price = 440  RS= 95  second  higher high  price=445  RSI = 88

As per the above condition


Buy Script:

 RSI(LOW,1)< REF(LOW,1) AND REF(LOW,2) < RSI(CLOSE,2)

Sell Script:

 RSI(HIGH,1)< REF(HIGH,1) AND REF(HIGH,2) < RSI(HIGH,2)

Please explain what is first and secound refers to ?

I want use this strategy ONE HR time frame, First One hour bar , second one hour bar .

This script not run due to RSI period argument is invalid.