커뮤니티

부탁합니다

프로필 이미지
as8282
2022-09-11 13:06:11
1331
글번호 162099
답변완료
1. 하기수식을 예스로 부탁합니다. 기간을 지표속성창에서 바꿀수있게 부탁합니다. MTF_RSI = input(true, 'MTF_RSI On / Off Switch', group=group11) TF_Len_1 = input.int(14, 'Lookback 1H ', group=group11) TF_Len_2 = input.int(14, 'Lookback 4H', group=group11) TF_Len_3 = input.int(14, 'Lookback 1D', group=group11) // tf function TF_1 = input.timeframe(defval='60', title='1H', inline=group11, group=group11) TF_2 = input.timeframe(defval='240', title='4H', inline=group11, group=group11) TF_3 = input.timeframe(defval='D', title='1D', inline=group11, group=group11) S_1 = MTF_RSI ? request.security(syminfo.tickerid, TF_1, ta.rsi(rsrc, TF_Len_1)) : na S_2 = MTF_RSI ? request.security(syminfo.tickerid, TF_2, ta.rsi(rsrc, TF_Len_2)) : na S_3 = MTF_RSI ? request.security(syminfo.tickerid, TF_3, ta.rsi(rsrc, TF_Len_3)) : na // plot plot(series=S_1, title='TF_1H', color=color.new(#ffeb3b, 30), linewidth=4) plot(series=S_2, title='TF_4H', color=color.new(#ff9800, 40), linewidth=4) plot(series=S_3, title='TF_1D', color=color.new(#b22833, 50), linewidth=4) 2. 아래수식에서 선을 굵게 부탁합니다. TL_SetColor(tempTL,Yellow);
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-09-13 14:16:51

안녕하세요 예스스탁입니다. 1 RSI는 타분봉 RSI와 일봉 RSI를 계산하는 수식을 올려드립니다. 아래식들 응용하시기 바랍니다. 1-1 타분봉 RSI Input : 분(60), Length(14); var : cnt(0),S1(0),D1(0),TM(0),TF(0); var : SigSum(0),count2(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"); } 1-2 일봉 RSI Input : Length(9); var : cnt(0),SigSum(0),count2(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 { 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"); PlotBaseLine1(30, "기준선 30"); PlotBaseLine2(70, "기준선 70"); 2 추세선 함수 중 TL_SetSize함수가 추세선의 굵기를 지정하는 함수입니다. 함수에 대한 설명은 예스랭귀지 도움말 참고하시기 바랍니다. TL_SetSize(tempTL,2); 즐거운 하루되세요 > as8282 님이 쓴 글입니다. > 제목 : 부탁합니다 > 1. 하기수식을 예스로 부탁합니다. 기간을 지표속성창에서 바꿀수있게 부탁합니다. MTF_RSI = input(true, 'MTF_RSI On / Off Switch', group=group11) TF_Len_1 = input.int(14, 'Lookback 1H ', group=group11) TF_Len_2 = input.int(14, 'Lookback 4H', group=group11) TF_Len_3 = input.int(14, 'Lookback 1D', group=group11) // tf function TF_1 = input.timeframe(defval='60', title='1H', inline=group11, group=group11) TF_2 = input.timeframe(defval='240', title='4H', inline=group11, group=group11) TF_3 = input.timeframe(defval='D', title='1D', inline=group11, group=group11) S_1 = MTF_RSI ? request.security(syminfo.tickerid, TF_1, ta.rsi(rsrc, TF_Len_1)) : na S_2 = MTF_RSI ? request.security(syminfo.tickerid, TF_2, ta.rsi(rsrc, TF_Len_2)) : na S_3 = MTF_RSI ? request.security(syminfo.tickerid, TF_3, ta.rsi(rsrc, TF_Len_3)) : na // plot plot(series=S_1, title='TF_1H', color=color.new(#ffeb3b, 30), linewidth=4) plot(series=S_2, title='TF_4H', color=color.new(#ff9800, 40), linewidth=4) plot(series=S_3, title='TF_1D', color=color.new(#b22833, 50), linewidth=4) 2. 아래수식에서 선을 굵게 부탁합니다. TL_SetColor(tempTL,Yellow);