Search

RSI

함수설명

RSI(Relative Strength Index) 지표함수

작성방법

RSI(기간)
C
복사

매개변수 설명

"기간": Numeric, 최근 N개봉 기간값을 입력
계산
A1 = N기간 상승폭의 합계 B1 = N기간 하락폭의 합계 RSI = A1/(A1+B1)*100

활용예시

//인라인함수(수식안에서 만들어 사용하는 함수) Function Infx_RSI Numeric { Inputs: Length(NumericSimple); Var : Counter(0), DownAmt(0), UpAmt(0); var : UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); If CurrentBar == 1 AND Length > 0 Then { UpSum = 0; DownSum = 0; For Counter = 0 To Length - 1 { UpAmt = C[Counter] - C[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; } UpAvg = UpSum / Length; DownAvg = DownSum / Length; } Else If CurrentBar > 1 AND Length > 0 Then { UpAmt = C[0] - C[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (UpAvg[1] * (Length - 1) + UpAmt) / Length; DownAvg = (DownAvg[1] * (Length - 1) + DownAmt) / Length; } If UpAvg + DownAvg <> 0 Then Infx_RSI = 100 * UpAvg / (UpAvg + DownAvg); Else Infx_RSI = 0; } EndFunction Input : Period(9),sig(10); var : RSIV(0),RSIS(0); RSIV = Infx_RSI(Period); RSIS = ma(RSIV,sig); Plot1(RSIV, "RSI"); Plot2(RSIS, "signal"); PlotBaseLine1(30, "기준선 30"); PlotBaseLine2(70, "기준선 70");
C
복사
뒤로가기는 좌측상단의 목차 버튼을 눌러주세요.