#공통, 전략
[설명]
RCI(Rank Correlation Index)는 순위상관지수라고도 불리는데 지표로
가격 움직임의 방향성 일관성을 측정하는 데 도움을 주는 오실레이터입니다.
RCI가 -80 이하에서 저점(SwingLow) 발생하고 0선 상향돌파하면 매수
RCI가 +80 이상에서 고점(Swinghigh) 발생하고 0선 하향이탈하면 매도
//인라인 함수(수식내에서 함수정의)
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 : Length(10),Left(3),Right(3);
var : R(0),BuySetUp(False),SellSetUp(False);
R = RCI(C,Length);
if SwingLowBar(1,R,Left,Right,Left+Right+1) == Right Then
{
if R[Right] <= -80 Then
BuySetUp = true;
Else
BuySetUp = False;
}
if BuySetUp == true and CrossUp(R,0) Then
{
BuySetup = False;
Buy("B");
}
if MarketPosition >= 0 and SwingHighBar(1,R,Left,Right,Left+Right+1) == Right Then
{
if R[Right] >= 80 Then
SellSetUp = true;
Else
SellSetUp = False;
}
if SellSetUp == true and CrossDown(R,0) Then
{
SellSetUp = False;
Sell("S");
}
JavaScript
복사
