#공통, 전략
[설명]
RCI(Rank Correlation Index)는 순위상관지수라고도 불리는데 지표로
가격 움직임의 방향성 일관성을 측정하는 데 도움을 주는 오실레이터입니다.
RCI 장단기 이평의 크로스 시점을 기준 전략입니다.
단기 RCI가 0선 아래에서 장기 RCI를 상향돌파하면 매수
단기 RCI가 0선 위에서 장기 RCI를 하향이탈하면 매도
//인라인 함수(수식내에서 함수정의)
Function RCI Numeric
{
input : Price(Numeric);
input : Length(Numeric);
var : d(0),i(0),ii(0),p(0),ov(0),s(0),ord(0);
d = 0;
For i = 0 to Length - 1
{
p = Price[i];
ov = 1;
s = 0;
for ii = 0 to Length - 1
{
if p < Price[ii] Then
{
ov = ov + 1;
}
else
{
if p == Price[ii] Then
s = s + 1;
}
}
ord = ov + (s - 1) / 2.0;
d = d + pow((i + 1) - ord, 2);
}
RCI = (1.0 - 6.0 * d / (Length * (Length * Length - 1.0))) * 100.0;
}
EndFunction
input : shortLength(10),longLength(20);
var : ShortRCI(0),MidRCI(0),LongRCI(0);
ShortRCI = RCI(C,shortLength);
LongRCI = RCI(C,longLength);
if ShortRCI < 0 and CrossUp(ShortRCI,LongRCI) Then
Buy("B");
if ShortRCI > 0 and CrossDown(ShortRCI,LongRCI) Then
Sell("S");
JavaScript
복사
