Need amibroker AFL code for the following strategy

How do i us the ‘Last Price’ in coding in Amibroker AFL… Here is a simple strategy that i want to code in amibroker.

Long entry:
set x= bbt(close,20,2,simple)
ref(close,1)>ref(x,1) and

Exit Long:
Close or ref(low,1)

Short Entry:
set y=bbb(close,20,2,simple)
ref(close,1)<ref(y,1) and

Exit Short:
close or ref(low,1)

Also, can u please differentiate between the close price and the last price? for a 5 min candle starting at 10 am and closing at 10:05 am, will close price refer to the price at 10:05 am or it will be same as the last price when the candle is in formation.