REF(CLOSE, 1) triggering at previous to previous day's low value?

i need to buy at previous days high , or short at previous day’s low so my buy script is LAST = REF(HIGH, 1) for long position and LAST = REF(LOW, 1) for short position .

But the alerts get triggered for the previous to previous day’s (-2 days) high and low instead of yesterday’s high and low . What can i do to fix this ?

As per the above query try to use

LAST >= REF(HIGH,1)