커뮤니티

수식변환 부탁드립니다.

프로필 이미지
이글루
2025-06-20 23:04:17
339
글번호 191983
답변완료
수식변환 부탁드립니다.늘 감사합니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-06-23 10:50:04

안녕하세요 예스스탁입니다. input : rsiLengthInput(14); var : change(0),alpha(0),src1(0),src2(0),up(0),down(0),RSI(0); change = C-C[1]; alpha = 1/rsiLengthInput; src1 = max(change, 0); src2 = -min(change, 0); up = iff(IsNaN(up[1]) == true, ma(src1, rsiLengthInput) , alpha * src1 + (1 - alpha) * IFf(IsNan(up[1])==true,0,up[1])); down = iff(IsNaN(down[1]) == true, ma(src2, rsiLengthInput) , alpha * src2 + (1 - alpha) * IFf(IsNan(down[1])==true,0,down[1])); rsi = iff(down == 0 , 100 , iff(up == 0 , 0 , 100 - (100 / (1 + up / down)))); plot1(rsi, "RSI", Violet); PlotBaseLine1(70, "RSI Upper Band", Gray); PlotBaseLine2(50, "RSI Middle Band", Gray); PlotBaseLine3(30, "RSI Lower Band", Gray); input : maTypeInput(1);#1:SMA, 2:SMA + Bollinger Bands, 3:EMA, 4:SMMA(RMA), 5:WMA, 6:VWMA input : maLengthInput(14); input : bbMultInput(2.0); var : smoothingMA(0),smoothingStDev(0); if maTypeInput == 1 then smoothingMA = ma(rsi, maLengthInput); if maTypeInput == 2 then { smoothingMA = ma(rsi, maLengthInput); smoothingStDev = std(rsi, maLengthInput) * bbMultInput; } if maTypeInput == 3 then smoothingMA = ema(rsi, maLengthInput); if maTypeInput == 4 then { alpha = 1/maLengthInput; smoothingMA = iff(Isnan(smoothingMA[1]) == true , ma(rsi, maLengthInput) , alpha * rsi + (1 - alpha) * iff(isnan(smoothingMA[1]) == true,0,smoothingMA[1])); } if maTypeInput == 5 then smoothingMA = wma(rsi, maLengthInput); if maTypeInput == 6 then { smoothingMA = ma(rsi * volume, maLengthInput) / ma(volume, maLengthInput); } plot2(smoothingMA, "RSI-based MA", yellow); if maTypeInput == 2 Then { plot3(smoothingMA + smoothingStDev, "Upper Bollinger Band",green); plot4(smoothingMA - smoothingStDev, "Lower Bollinger Band",green); } Else { NoPlot(3); NoPlot(4); } // Divergence var : lookbackRight(5),lookbackLeft(5),rangeUpper(60),rangeLower(6); var : bearColor(red),bullColor (green); var : SLV(0),SLP(0),SLD(0),SLT(0),SLI(0); var : SLV1(0),SLP1(0),SLD1(0),SLT1(0),SLI1(0); var : SHV(0),SHP(0),SHD(0),SHT(0),SHI(0); var : SHV1(0),SHP1(0),SHD1(0),SHT1(0),SHI1(0); var : TL1(0),TX1(0),TL2(0),TX2(0); if SwingLow(1,rsi,lookbackLeft,lookbackRight,lookbackLeft+lookbackRight+1) != -1 Then { SLV = rsi[lookbackRight]; SLV1 = SLV[1]; SLP = low[lookbackRight]; SLP1 = SLP[1]; SLD = sDate[lookbackRight]; SLD1 = SLD[1]; SLT = sTime[lookbackRight]; SLT1 = SLT[1]; SLI = Index; SLI1 = SLI[1]; if SLV > SLV1 and SLP < SLP1 and SLI >= SLI1+rangeLower and SLI <= SLI1+rangeUpper Then { TL1 = TL_New_Self(SLD1,SLT1,SLV1,SLD,SLT,SLV); TL_SetColor(TL1,bullColor); TL_SetSize(TL1,2); TX1 = Text_New_Self(SLD,SLT,SLV,"Bull"); Text_SetColor(TX1,bullColor); Text_SetSize(TX1,12); Text_SetStyle(TX1,2,0); } } if SwingHigh(1,rsi,lookbackLeft,lookbackRight,lookbackLeft+lookbackRight+1) != -1 Then { SHV = rsi[lookbackRight]; SHV1 = SHV[1]; SHP = low[lookbackRight]; SHP1 = SHP[1]; SHD = sDate[lookbackRight]; SHD1 = SHD[1]; SHT = sTime[lookbackRight]; SHT1 = SHT[1]; SHI = Index; SHI1 = SHI[1]; if SHV < SHV1 and SHP > SHP1 and SHI >= SHI1+rangeLower and SHI <= SHI1+rangeUpper Then { TL2 = TL_New_Self(SHD1,SHT1,SHV1,SHD,SHT,SHV); TL_SetColor(TL2,bearColor); TL_SetSize(TL2,2); TX2 = Text_New_Self(SHD,SHT,SHV,"Bear"); Text_SetColor(TX2,bearColor); Text_SetSize(TX2,12); Text_SetStyle(TX2,2,1); } } 즐거운 하루되세요 > 이글루 님이 쓴 글입니다. > 제목 : 수식변환 부탁드립니다. > 수식변환 부탁드립니다.늘 감사합니다