I am trying to calculate the 2-period RSI manually. Something seem to be wrong with my formula..
a1=ref(C,-1)-ref(C,-2);
a2=C-ref(C,-1);
b1=IIf(a1>0,a1,0);
b2=iIf(a2>0,a2,0);
c1=IIf(a1<0,0-a1,0);
c2=IIf(a2<0,0-a2,0);
c3=(b1+b2)/2;
c4=(c1+c2)/2;
e1=c3/c4;
RSI=iif(c4==0,100,100-(100/1+e1));