func = RSI() ;
local rsi_count={}
nk=ds[real]:Size()
for i=1,nk do rsi_count[i]=func(i, {Period=rsi_period, VType="Typical"}, ds[real]) end
if rsi_count[nk]~=nil then
rsi0=rsi_count[nk]
rsi1=rsi_count[nk-1]
rsi2=rsi_count[nk-2]
rsi3=rsi_count[nk-3]
rsi4=rsi_count[nk-4]
max_rsi=math.max(rsi0,rsi1,rsi2,rsi3,rsi4)
in_rsi=math.min(rsi0,rsi1,rsi2,rsi3,rsi4)
else
mm (real.." "..nk.." rsi_count[num_candles]=nil") ; sleep (100)
end