커뮤니티

수식 재문의

프로필 이미지
에구머니
2026-03-03 18:28:43
137
글번호 230869
답변완료

안녕하세요?


글번호 230818

에 대해서 답변 주신 것에 대해서 그 글의 답변에 재문의를 했습니다.


제가 궁금한 것은 그렇게 하면 되는 건지,

아니면, 지금처럼 새 글로 재문의를 해야 하는 건지도 잘 모르겠습니다.


그리고, 내친 김에 아래의 Stochastic RSI도 예스로 하나 부탁드립니다.


//@version=5

indicator(title="Stochastic RSI", shorttitle="Stoch RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)

smoothK = input.int(3, "K", minval=1)

smoothD = input.int(3, "D", minval=1)

lengthRSI = input.int(14, "RSI Length", minval=1)

lengthStoch = input.int(14, "Stochastic Length", minval=1)

src = input(close, title="RSI Source")

rsi1 = ta.rsi(src, lengthRSI)

k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)

d = ta.sma(k, smoothD)

plot(k, "K", color=#2962FF)

plot(d, "D", color=#FF6D00)

h0 = hline(80, "Upper Band", color=#787B86)

hline(50, "Middle Band", color=color.new(#787B86, 50))

h1 = hline(20, "Lower Band", color=#787B86)

fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background") // 이런거는 되면 좋고, 안 되어도 상관 없습니다.


늘 감사드립니다.


지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-03-04 13:40:54

안녕하세요 예스스탁입니다. A. 230818번 글에 답변드렸습니다. 아래 내용과 같습니다. 추가문의는 새글로 주셔도 되고 답변으로 주셔도 됩니다. 1 sum2가 봉수를 카운트 하여 변경했는데 이전 것이 남겨 있었습니다. 함수식에 봉수를 카운트 하는 sum2가 있어 해당 값으로 수정해 드립니다. Inputs: price(Numeric),Period(NumericSimple); var : sum1(0),sum2(0),TH(0),TL(0); if Bdate != Bdate[1] Then { sum1 = 0; sum2 = 0; mdayAtr2 = Nan; } Else { if price[1] > price then TH = price[1]; else TH = price; If price[1] < price then TL = price[1]; else TL = price; sum1 = sum1 + (TH-TL); sum2 = sum2 + 1; if sum2 < Period Then mdayAtr2 = sum1/sum2; Else mdayAtr2 = ma(TH-TL,Period); } 2 input : Period(14); var : R(0,Data2),i2(0,Data2),v1(0,Data2); var : PreV1(0,Data1); R = data2(mdayAtr2(C,Period)); #매일 Period번재 충족하는 첫값 저장 if IsNan(R) == true Then i2 = 0; Else { i2 = i2+1; if i2 == Period Then v1 = R; } #Data1날짜변경시 다른변수에 값 저장해 사용 if Data1(Bdate != Bdate[1]) Then preV1 = v1; Plot1(R); plot3(Prev1); B. 변환식입니다. input : smoothK(3); input : smoothD(3); input : lengthRSI(14); input : lengthStoch(14); var : rsi1(0),f(0),k(0),d(0); rsi1 = rsi(lengthRSI); f = (rsi1-lowest(rsi1,lengthStoch)) / ( highest(rsi1,lengthStoch)-lowest(rsi1,lengthStoch) ) *100 ; k = ma(f, smoothK); d = ma(k, smoothD); plot1(k, "K", Red); plot2(d, "D", Blue); PlotBaseLine1(80,"Upper Band", Gray); PlotBaseLine2(50,"Middle Band",Gray); PlotBaseLine3(20,"Lower Band",Gray); 즐거운 하루되세요