커뮤니티

문의

프로필 이미지
레전드
2022-09-18 21:28:09
647
글번호 162278
답변완료
1분봉에서 3분봉 RSI 부탁드립니다 데이타2에도 적용하게 부탁드립니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-09-19 14:28:36

안녕하세요 예스스탁입니다. 1 Input : 타주기분(3), Length(14); var : cnt(0),S1(0),D1(0),TM(0),TF(0); var : SigSum(0),RSIsig(0); Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0); var : idx(0), PreUpAvg(0), preDownAvg(0),RSIV(0); Array : C1[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TimeToMinutes(stime)%타주기분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or (Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then { for cnt = 1 to 99{ C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = C; If idx == Length+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To Length - 1 { UpAmt = C1[Counter] - C1[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; } If idx > Length+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (Length - 1) + UpAmt) / Length; DownAvg = (preDownAvg * (Length - 1) + DownAmt) / Length; } If UpAvg + DownAvg <> 0 Then RSIv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIv = 0; plot1(RSIv,"RSI"); } 2 Input : 타주기분(3), Length(14); var : cnt(0,Data2),S1(0,Data2),D1(0,Data2),TM(0,Data2),TF(0,Data2); var : SigSum(0,Data2),RSIsig(0,Data2); Var : Counter(0,Data2), DownAmt(0,Data2), UpAmt(0,Data2), UpSum(0,Data2), DownSum(0,Data2), UpAvg(0,Data2), DownAvg(0,Data2); var : idx(0,Data2), PreUpAvg(0,Data2), preDownAvg(0,Data2),RSIV(0,Data2); Array : C1[100](0,Data2); if Bdate != Bdate[1] Then { S1 = data2(TimeToMinutes(stime)); D1 = data2(sdate); } if D1 > 0 then { if data2(sdate == D1) Then TM = data2(TimeToMinutes(stime)-S1); Else TM = data2(TimeToMinutes(stime)+1440-S1); TF = TM%타주기분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or (Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then { for cnt = 1 to 99{ C1[cnt] = C1[cnt-1][1]; } PreUpAvg = UpAvg[1]; preDownAvg = DownAvg[1]; idx = idx + 1; } C1[0] = data2(C); If idx == Length+2 Then { UpSum = 0; DownSum = 0; For Counter = 0 To Length - 1 { UpAmt = C1[Counter] - C1[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; } If idx > Length+2 Then { UpAmt = C1[0] - C1[1]; If UpAmt >= 0 Then DownAmt = 0; Else { DownAmt = -UpAmt; UpAmt = 0; } UpAvg = (PreUpAvg * (Length - 1) + UpAmt) / Length; DownAvg = (preDownAvg * (Length - 1) + DownAmt) / Length; } If UpAvg + DownAvg <> 0 Then RSIv = 100 * UpAvg / (UpAvg + DownAvg); Else RSIv = 0; plot1(RSIv,"RSI"); } 즐거운 하루되세요 > 레전드 님이 쓴 글입니다. > 제목 : 문의 > 1분봉에서 3분봉 RSI 부탁드립니다 데이타2에도 적용하게 부탁드립니다