Tuesday, August 28, 2012

Indicator: RCI(Rank Correlation Index)

This Indicator will find the highest high and the lowest low with a given range and will find out if the security is over or undervalued. It is very much like Stoachastic but with different time periods








Input : Period(Numeric);
Var : cnt(0),Nth(0),tempmax(0), tempindex(0), X1(0),RCI1(0);
Array : VALUE1[50](0),NTHVALUE[50](0);


for cnt = 0 to 49{
VALUE1[cnt] = C[cnt];
}

For Nth = 0 to Period-1 {
tempmax = -99999999;
For cnt = 0 to Period-1{
if VALUE1[cnt] > tempmax then{
tempmax = VALUE1[cnt];
tempIndex = cnt;
NTHVALUE[cnt] = Nth+1;
}
}
VALUE1[tempIndex] = -99999999;
}

X1 = 0;
for cnt = 0 to period-1{
X1 = X1+abs((cnt+1)-NTHVALUE[cnt])^2;
}

RCI = (1-(6*X1)/(period*(period^2-1)))*100;


input : P1(9), P2(13), P3(18), P4(26);

plot1(RCI(P1));
plot2(RCI(P2));
plot3(RCI(P3));
plot4(RCI(P4));
PlotBaseLine1(80, "baseLine", gray);
PlotBaseLine2(-80, "baseLine", gray);


-Charles Sin

No comments:

Post a Comment