n:=6;
variable:k0=drawnull,d0=drawnull;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
IF BARPOS=N+1 then k0:=50*2/3+RSV/3;
k1:=ref(k0,1);
if barpos>n+1 then k:=(k1*2/3+RSV/3);
IF BARPOS=N+1 then d0:=50*2/3+K/3;
d1:=ref(d0,1);
if barpos>n+1 then d:=(d1*2/3+K/3);
kk:k;
dd:d;