커뮤니티

RCI에 갭보정 적용, 그리고 기준선 삽입

프로필 이미지
까냐스키
2011-06-28 01:05:22
648
글번호 40232
답변완료
아래 수식은 RCI지표 수식입니다. ---------------------------------------- input : P1(9),P2(13),P3(18),P4(26); Var : cnt(0),Nth(0),tempmax(0), tempindex(0), X1(0),RCI1(0),X2(0),RCI2(0),X3(0),RCI3(0),X4(0),RCI4(0); Array : VALUE1[50](0),VALUE2[50](0),VALUE3[50](0),VALUE4[50](0),NTHVALUE[50](0); for cnt = 0 to 49{ VALUE1[cnt] = C[cnt]; VALUE2[cnt] = C[cnt]; VALUE3[cnt] = C[cnt]; VALUE4[cnt] = C[cnt]; } ############################################### For Nth = 0 to P1-1 { tempmax = -99999999; For cnt = 0 to P1-1{ if VALUE1[cnt] > tempmax then{ tempmax = VALUE1[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE1[tempIndex] = -99999999; } X1 = 0; for cnt = 0 to P1-1{ X1 = X1+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI1 = (1-(6*X1)/(P1*(P1^2-1)))*100; ############################################### For Nth = 0 to P2-1 { tempmax = -99999999; For cnt = 0 to P2-1{ if value2[cnt] > tempmax then{ tempmax = value2[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE2[tempIndex] = -99999999; } X2 = 0; for cnt = 0 to P2-1{ X2 = X2+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI2 = (1-(6*X2)/(P2*(P2^2-1)))*100; ############################################### For Nth = 0 to P3-1 { tempmax = -99999999; For cnt = 0 to P3-1{ if value3[cnt] > tempmax then{ tempmax = value3[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE3[tempIndex] = -99999999; } X3 = 0; for cnt = 0 to P3-1{ X3 = X3+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI3 = (1-(6*X3)/(P3*(P3^2-1)))*100; ############################################### For Nth = 0 to P4-1 { tempmax = -99999999; For cnt = 0 to P4-1{ if value4[cnt] > tempmax then{ tempmax = value4[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE4[tempIndex] = -99999999; } X4 = 0; for cnt = 0 to P4-1{ X4 = X4+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI4 = (1-(6*X4)/(P4*(P4^2-1)))*100; plot1(RCI1); plot2(RCI2); plot3(RCI3); plot4(RCI4); ₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩ 위의 지표를 갭보정이 적용된 지표로 바꾸어 사용하고 싶습니다. 아울러 아래위로 기준선도 삽입하고 싶습니다. 수식을 부탁드립니다. 감사합니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-06-28 11:34:50

안녕하세요 예스스탁입니다. input : P1(9),P2(13),P3(18),P4(26); Var : cnt(0),Nth(0),tempmax(0), tempindex(0), X1(0),RCI1(0),X2(0),RCI2(0),X3(0),RCI3(0),X4(0),RCI4(0); Array : VALUE1[50](0),VALUE2[50](0),VALUE3[50](0),VALUE4[50](0),NTHVALUE[50](0); var : sumGap(0), gap(0), GO(0), GH(0), GL(0), GC(0); if date!=date[1] then { gap = Open-Close[1]; sumGap = sumGap+gap; } GC = C - sumGap; // plot1(GO,"갭보정 시가"); plot2(GH,"갭보정 고가"); plot3(GL,"갭보정 저가"); plot4(Gc,"갭보정 종가"); for cnt = 0 to 49{ VALUE1[cnt] = GC[cnt]; VALUE2[cnt] = GC[cnt]; VALUE3[cnt] = GC[cnt]; VALUE4[cnt] = GC[cnt]; } ############################################### For Nth = 0 to P1-1 { tempmax = -99999999; For cnt = 0 to P1-1{ if VALUE1[cnt] > tempmax then{ tempmax = VALUE1[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE1[tempIndex] = -99999999; } X1 = 0; for cnt = 0 to P1-1{ X1 = X1+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI1 = (1-(6*X1)/(P1*(P1^2-1)))*100; ############################################### For Nth = 0 to P2-1 { tempmax = -99999999; For cnt = 0 to P2-1{ if value2[cnt] > tempmax then{ tempmax = value2[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE2[tempIndex] = -99999999; } X2 = 0; for cnt = 0 to P2-1{ X2 = X2+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI2 = (1-(6*X2)/(P2*(P2^2-1)))*100; ############################################### For Nth = 0 to P3-1 { tempmax = -99999999; For cnt = 0 to P3-1{ if value3[cnt] > tempmax then{ tempmax = value3[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE3[tempIndex] = -99999999; } X3 = 0; for cnt = 0 to P3-1{ X3 = X3+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI3 = (1-(6*X3)/(P3*(P3^2-1)))*100; ############################################### For Nth = 0 to P4-1 { tempmax = -99999999; For cnt = 0 to P4-1{ if value4[cnt] > tempmax then{ tempmax = value4[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE4[tempIndex] = -99999999; } X4 = 0; for cnt = 0 to P4-1{ X4 = X4+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI4 = (1-(6*X4)/(P4*(P4^2-1)))*100; plot1(RCI1); plot2(RCI2); plot3(RCI3); plot4(RCI4); PlotBaseLine1(80); PlotBaseLine2(-80); 즐거운 하루되세요 > 까냐스키 님이 쓴 글입니다. > 제목 : RCI에 갭보정 적용, 그리고 기준선 삽입 > 아래 수식은 RCI지표 수식입니다. ---------------------------------------- input : P1(9),P2(13),P3(18),P4(26); Var : cnt(0),Nth(0),tempmax(0), tempindex(0), X1(0),RCI1(0),X2(0),RCI2(0),X3(0),RCI3(0),X4(0),RCI4(0); Array : VALUE1[50](0),VALUE2[50](0),VALUE3[50](0),VALUE4[50](0),NTHVALUE[50](0); for cnt = 0 to 49{ VALUE1[cnt] = C[cnt]; VALUE2[cnt] = C[cnt]; VALUE3[cnt] = C[cnt]; VALUE4[cnt] = C[cnt]; } ############################################### For Nth = 0 to P1-1 { tempmax = -99999999; For cnt = 0 to P1-1{ if VALUE1[cnt] > tempmax then{ tempmax = VALUE1[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE1[tempIndex] = -99999999; } X1 = 0; for cnt = 0 to P1-1{ X1 = X1+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI1 = (1-(6*X1)/(P1*(P1^2-1)))*100; ############################################### For Nth = 0 to P2-1 { tempmax = -99999999; For cnt = 0 to P2-1{ if value2[cnt] > tempmax then{ tempmax = value2[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE2[tempIndex] = -99999999; } X2 = 0; for cnt = 0 to P2-1{ X2 = X2+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI2 = (1-(6*X2)/(P2*(P2^2-1)))*100; ############################################### For Nth = 0 to P3-1 { tempmax = -99999999; For cnt = 0 to P3-1{ if value3[cnt] > tempmax then{ tempmax = value3[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE3[tempIndex] = -99999999; } X3 = 0; for cnt = 0 to P3-1{ X3 = X3+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI3 = (1-(6*X3)/(P3*(P3^2-1)))*100; ############################################### For Nth = 0 to P4-1 { tempmax = -99999999; For cnt = 0 to P4-1{ if value4[cnt] > tempmax then{ tempmax = value4[cnt]; tempIndex = cnt; NTHVALUE[cnt] = Nth+1; } } VALUE4[tempIndex] = -99999999; } X4 = 0; for cnt = 0 to P4-1{ X4 = X4+ABS((cnt+1)-NTHVALUE[cnt])^2; } RCI4 = (1-(6*X4)/(P4*(P4^2-1)))*100; plot1(RCI1); plot2(RCI2); plot3(RCI3); plot4(RCI4); ₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩₩ 위의 지표를 갭보정이 적용된 지표로 바꾸어 사용하고 싶습니다. 아울러 아래위로 기준선도 삽입하고 싶습니다. 수식을 부탁드립니다. 감사합니다.