커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

종목검색식 부탁드립니다

1. 아래지표를 참고하여, (수식2) "과매수" 를, 일봉기준으로 "5일중 2일이상"을 "과매수"하는 종목의 종목검색식 부탁드려요. ("몇일중 몇일이상" 은 변수로 처리해주세요) ----아래------- (수식1) 매수 i_wvf = ((high - lowest(C, 22)) / lowest(C, 22)) * 100; i_sDev = 2.0 * stdev(i_wvf, 20); i_midLine = avg(i_wvf, 20); i_upperBand = i_midLine + i_sDev; i_rangeHigh = (highest(i_wvf, 50)) * ph; i_wvf; (수식2) 과매수 i_wvf = ((high - lowest(C, 22)) / lowest(C, 22)) * 100; i_sDev = 2.0 * stdev(i_wvf, 20); i_midLine = avg(i_wvf, 20); i_upperBand = i_midLine + i_sDev; i_rangeHigh = (highest(i_wvf, 50)) * ph; if(i_wvf >= i_upperBand or i_wvf >= i_rangeHigh, i_wvf, 0); (수식3) 과매수이탈 i_wvf = ((H - lowest(C, 22)) / lowest(C, 22)) * 100; i_sDev = 2.0 * stdev(i_wvf, 20); i_midLine = avg(i_wvf, 20); i_upperBand = i_midLine + i_sDev; i_rangeHigh = (highest(i_wvf, 50)) * ph; ob = (i_wvf >= i_upperBand) or (i_wvf >= i_rangeHigh); if(ob,1,0); //os : OverBuy // 과매수 4회이상 연속후 이탈) if( ((ob(1)>0 and ob(2)>0 and ob(3)>0 and ob(4)>0) and ob == 0), i_wvf, 0); -지표조건설정 PH : 0.55
프로필 이미지
일지매7
2025-09-14
127
글번호 193989
종목검색
답변완료

부탁드립니다 항상 감사합니다

import numpy as np import matplotlib.pyplot as plt np.random.seed(3) # 1) 가상의 OHLC 데이터 만들기 n = 120 base = 100 + np.cumsum(np.random.randn(n)*0.6) high = base + np.abs(np.random.randn(n)*0.5) low = base - np.abs(np.random.randn(n)*0.5) close = base.copy() # 2) 파라미터 length = 14 # 채널 길이 len2 = 6 # Exit 단기 길이 def rolling_max(x, w, i): s = max(0, i-w+1) return np.max(x[s:i+1]) def rolling_min(x, w, i): s = max(0, i-w+1) return np.min(x[s:i+1]) upper = np.zeros(n) lower = np.zeros(n) up = np.zeros(n) down = np.zeros(n) sup = np.zeros(n) sdown = np.zeros(n) for i in range(n): upper[i] = rolling_max(high, length, i) lower[i] = rolling_min(low , length, i) up[i] = rolling_max(high, length, i) down[i] = rolling_min(low , length, i) sup[i] = rolling_max(high, len2 , i) sdown[i] = rolling_min(low , len2 , i) # 3) Trend Line(K1): 최근 고점/저점 갱신 시점 비교 trend_line = np.zeros(n) k2 = np.zeros(n) # Exit Line(K2) last_high_idx = 0 last_low_idx = 0 for i in range(1, n): # 최근 고점/저점 갱신 판정 if high[i] >= up[i-1]: last_high_idx = i if low[i] <= down[i-1]: last_low_idx = i # i 시점의 추세 up_trend = last_high_idx >= last_low_idx # K1 선택: 상승이면 up, 하락이면 down trend_line[i] = up[i] if up_trend else down[i] # K2 선택: 상승이면 sdown(저점선=손절), 하락이면 sup(고점선=손절) k2[i] = sdown[i] if up_trend else sup[i] trend_line[0] = up[0] k2[0] = sdown[0] # 4) 신호 계산 (buy/sell) + 청산 buy_sig = np.zeros(n, dtype=bool) sell_sig = np.zeros(n, dtype=bool) buy_exit = np.zeros(n, dtype=bool) sell_exit = np.zeros(n, dtype=bool) for i in range(1, n): # 채널 돌파 신호 buy_sig[i] = (high[i] >= upper[i-1]) and (high[i-1] < upper[i-1]) sell_sig[i] = (low[i] <= lower[i-1]) and (low[i-1] > lower[i-1]) # 추세에 따른 Exit 판정 up_trend = trend_line[i] == up[i] # 간단 판별 if up_trend: buy_exit[i] = (low[i] <= sdown[i-1]) and (low[i-1] > sdown[i-1]) else: sell_exit[i] = (high[i] >= sup[i-1]) and (high[i-1] < sup[i-1]) # 5) 시각화 (규정: seaborn 미사용, 단일 플롯, 색상 지정 안 함) plt.figure(figsize=(13,6)) plt.plot(close, label="Price") plt.plot(upper, label="Upper") plt.plot(lower, label="Lower") plt.plot(trend_line, label="Trend Line (K1)") plt.plot(k2, label="Exit Line (K2)") # 텍스트 라벨: '수' / '도' / '청' for i in range(n): if buy_sig[i]: plt.text(i, low[i], "수") if sell_sig[i]: plt.text(i, high[i], "도") if buy_exit[i]: plt.text(i, low[i], "청") if sell_exit[i]: plt.text(i, high[i], "청") plt.title("Trend Line (K1) + Exit Line (K2) + ‘수/도/청’ 신호 예시") plt.xlabel("Bar Index") plt.ylabel("Price") plt.legend() plt.grid(True) plt.show() 전환부탁드립니다 감사합니다
프로필 이미지
윤호석
2025-09-14
145
글번호 193988
지표
답변완료

수식 부탁드립니다.

안녕하세요. 늘 많은 도움 주셔서 감사합니다. 1분봉에 3, 5,10,15,30,60분봉의 50,300,600 이평선이 그려지게 하고 싶은데요. 종가를 기준으로 계산된 이평선이 아니라 3,5,10,15분봉의 고가 이평선과 저가 이평선이 그려지게 하고 싶습니다. 타주기별 이평선이 2개(고가기준, 저가기준) 만들어지도록요. 이평선이 타주기 차트와 동일하게 1분봉 차트에 나타나게 하려면 이평갯수만큼 묶어서 최고가와 최저가를 적용하여 계산되어야 할 것 같습니다. 혼자 해보려니 자꾸 실패해서 도움 요청드립니다. 감사합니다!
프로필 이미지
길게가자
2025-09-14
154
글번호 193987
지표
답변완료

봉 길이 표시

수고 많습니다. 봉의 길이를 시가 와 종가를 기준(꼬리는 제외)으로 몸통의 길이를 1은 제외하고 첨부 그림처럼 양봉은 적색, 음봉은 파란색 숫자로 표기 부탁드립니다. 수고하세요.
프로필 이미지
나도부자1
2025-09-14
128
글번호 193986
지표
답변완료

이동평균 음영표시

수고 많으십니다. 가격 이동평균선의 증감율을 가지고 차트에 음영을 표시하고 싶은데 가능한지요? 첨부 파일은 코스피 국내선물 2025.09.12. 15시 04분 120틱 20선 이동평균입니다. 20일선 이동평균선의 증감율(10,000분율)이 증가율(상승추세) 0.3 이상은 RED, 감소율(하락추세) 0.3이상은 BLUE, 그 외의 증감율에 대해서는 무표시 또는 LIME색상으로 차트에 음영으로 표시가 되도록 만들어 주시면 감사하겠습니다. 그리고 모든 값은 변경 가능하게 변수로 부탁드립니다. 만분율의 계산은(최종수치-최초수치/최초수치)*10,000 으로 계산한 값입니다. 신속한 답변에 항상 감사드립니다. 수고하세요.
프로필 이미지
나도부자1
2025-09-14
126
글번호 193985
지표
답변완료

간단한건데 부탁드립니다.주봉,월봉기준

주봉과 월봉을 기준으로 하며 1.금번봉의 고가가 직전봉의 종가보다 2% 미만인 경우 챠트에 표시되게끔(=강세약세 등 화면으로) 수식을 부탁드립니다. 감사하고 미안합니다.
프로필 이미지
결사준수
2025-09-14
141
글번호 193984
지표
답변완료

종목 검색식 부탁드립니다

안녕하세요 3분봉에서 시초가 첫양봉인데 어제 종가보다 높은 양봉이며 두번째봉은 시초가 첫 양봉보다 높은 양봉인 종목 검색식 부탁드립니다 감사합니다
프로필 이미지
2025-09-13
139
글번호 193983
종목검색
답변완료

부탁드립니다 항상 감사합니다

{========================================== Disparity Index + RSI (YesLanguage version) - DI = 100 * (src - SMA(src,L)) / SMA(src,L) - scaledDI = 20 * DI + 50 - RSI = Wilder RMA - RSI MA/BB 옵션: 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA - Regular Bullish/Bearish Divergence (라벨) ==========================================} {----------- Inputs -----------} input: DI_Length(14); input: DI_Source(1); { 1=Close, 2=Open, 3=High, 4=Low, 5=Typical(H+L+C)/3 } input: RSI_Length(14); { RSI Smoothing / BB } input: MA_Type(1); { 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA } input: MA_Len(14); input: BB_Mult(2.0); { Divergence } input: CalcDivergence(false); input: LB_Left(5); input: LB_Right(5); input: RangeLower(5); input: RangeUpper(60); { Colors } input: DiUpColor(RGB(14,187,35)); { &#8776; #0ebb23 } input: DiDnColor(Red); input: LevelColor(Gray); input: RsiColor(RGB(126,87,194)); { &#8776; #7E57C2 } input: BBColor(Green); input: BullColor(Green); input: BearColor(Red); {----------- Vars -----------} vars: srcVal(0), smaDI(0), di(0), scaledDi(0), chg(0), up(0), dn(0), upRMA(0), dnRMA(0), rsi(0), rsiMA(0), rsiStDev(0), rsiBB_Up(0), rsiBB_Dn(0), bullCond(false), bearCond(false), rsiPivotLow(0), rsiPrevPivotLow(0), pxPivotLow(0), pxPrevPivotLow(0), rsiPivotHigh(0), rsiPrevPivotHigh(0), pxPivotHigh(0), pxPrevPivotHigh(0), pivBarsL(0), pivBarsH(0), lblBull(0), lblBear(0); {----------- Source 선택 -----------} if DI_Source = 1 then srcVal = Close else if DI_Source = 2 then srcVal = Open else if DI_Source = 3 then srcVal = High else if DI_Source = 4 then srcVal = Low else srcVal = (High + Low + Close) / 3; {----------- Disparity Index -----------} smaDI = Average(srcVal, DI_Length); if smaDI <> 0 then di = 100 * (srcVal - smaDI) / smaDI else di = 0; scaledDi = 20 * di + 50; { 색상 } vars: diColor(0); if scaledDi >= 50 then diColor = DiUpColor else diColor = DiDnColor; Plot1(scaledDi, "Scaled DI", diColor); Plot2(50, "DI 50", LevelColor); {----------- RSI (Wilder RMA) -----------} chg = Close - Close[1]; up = MaxList(chg, 0); dn = MaxList(-chg, 0); if CurrentBar = 1 then begin upRMA = up; dnRMA = dn; end else begin upRMA = (upRMA[1] * (RSI_Length - 1) + up) / RSI_Length; dnRMA = (dnRMA[1] * (RSI_Length - 1) + dn) / RSI_Length; end; if dnRMA = 0 then rsi = 100 else if upRMA = 0 then rsi = 0 else rsi = 100 - (100 / (1 + upRMA / dnRMA)); Plot3(rsi, "RSI", RsiColor); { RSI 레벨 라인: 70/60/50/40/30 } Plot4(70, "RSI 70", LevelColor); Plot5(60, "RSI 60", LevelColor); Plot6(50, "RSI 50", LevelColor); Plot7(40, "RSI 40", LevelColor); Plot8(30, "RSI 30", LevelColor); {----------- RSI Smoothing / BB -----------} { MA_Type: 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA } if MA_Type = 1 or MA_Type = 2 then rsiMA = Average(rsi, MA_Len) else if MA_Type = 3 then rsiMA = XAverage(rsi, MA_Len) else if MA_Type = 4 then begin if CurrentBar = 1 then rsiMA = rsi else rsiMA = (rsiMA[1] * (MA_Len - 1) + rsi) / MA_Len; end else if MA_Type = 5 then rsiMA = WAverage(rsi, MA_Len) else if MA_Type = 6 then rsiMA = Summation(rsi * Volume, MA_Len) / Summation(Volume, MA_Len) else rsiMA = 0; if MA_Type >= 1 then Plot9(rsiMA, "RSI_MA", Yellow); if MA_Type = 2 then begin rsiStDev = StdDev(rsi, MA_Len); rsiBB_Up = rsiMA + rsiStDev * BB_Mult; rsiBB_Dn = rsiMA - rsiStDev * BB_Mult; Plot10(rsiBB_Up, "RSI_BB_Up", BBColor); Plot11(rsiBB_Dn, "RSI_BB_Dn", BBColor); end; {----------- Regular Divergence -----------} if CalcDivergence then begin { RSI Pivot Low } if SwingLow(rsi, LB_Left, LB_Right, pivBarsL) then begin rsiPivotLow = rsi[pivBarsL]; pxPivotLow = Low[LB_Right]; bullCond = (rsiPrevPivotLow <> 0) and (pxPrevPivotLow <> 0) and (pxPivotLow < pxPrevPivotLow) { Price LL } and (rsiPivotLow > rsiPrevPivotLow) { RSI HL } and (pivBarsL >= RangeLower and pivBarsL <= RangeUpper); if bullCond then begin lblBull = Text_New(sDate[LB_Right], sTime[LB_Right], rsiPivotLow, " Bull "); Text_SetStyle(lblBull, 2, 0); Text_SetColor(lblBull, BullColor); end; rsiPrevPivotLow = rsiPivotLow; pxPrevPivotLow = pxPivotLow; end; { RSI Pivot High } if SwingHigh(rsi, LB_Left, LB_Right, pivBarsH) then begin rsiPivotHigh = rsi[pivBarsH]; pxPivotHigh = High[LB_Right]; bearCond = (rsiPrevPivotHigh <> 0) and (pxPrevPivotHigh <> 0) and (pxPivotHigh > pxPrevPivotHigh) { Price HH } and (rsiPivotHigh < rsiPrevPivotHigh) { RSI LH } and (pivBarsH >= RangeLower and pivBarsH <= RangeUpper); if bearCond then begin lblBear = Text_New(sDate[LB_Right], sTime[LB_Right], rsiPivotHigh, " Bear "); Text_SetStyle(lblBear, 2, 1); Text_SetColor(lblBear, BearColor); end; rsiPrevPivotHigh = rsiPivotHigh; pxPrevPivotHigh = pxPivotHigh; end; end; 수정부탁드립니다
프로필 이미지
윤호석
2025-09-13
176
글번호 193982
지표
답변완료

부탁드립니다 항상 감사합니다

//@version=6 indicator(title="Multiple Moving Averages & 3 Bollinger Bands", shorttitle="Multi MA & 3 BB", overlay=true) &#8203; // Function to calculate different types of Moving Averages ma(source, length, type) => float result = na switch type "SMA" => result = ta.sma(source, length) "EMA" => result = ta.ema(source, length) "WMA" => result = ta.wma(source, length) "RMA" => result = ta.rma(source, length) "VWMA" => result = ta.vwma(source, length) result &#8203; // --- Moving Average Settings --- GRP_MA1 = "Moving Average 1" ma1_enable = input.bool(true, "Enable MA 1", group=GRP_MA1) ma1_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA1) ma1_length = input.int(20, "Length", minval=1, group=GRP_MA1) ma1_color = input.color(color.blue, "Color", group=GRP_MA1) ma1 = ma(close, ma1_length, ma1_type) plot(ma1_enable ? ma1 : na, title="MA 1", color=ma1_color, linewidth=2, display=display.all) &#8203; GRP_MA2 = "Moving Average 2" ma2_enable = input.bool(true, "Enable MA 2", group=GRP_MA2) ma2_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA2) ma2_length = input.int(30, "Length", minval=1, group=GRP_MA2) ma2_color = input.color(color.orange, "Color", group=GRP_MA2) ma2 = ma(close, ma2_length, ma2_type) plot(ma2_enable ? ma2 : na, title="MA 2", color=ma2_color, linewidth=2, display=display.all) &#8203; GRP_MA3 = "Moving Average 3" ma3_enable = input.bool(true, "Enable MA 3", group=GRP_MA3) ma3_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA3) ma3_length = input.int(60, "Length", minval=1, group=GRP_MA3) ma3_color = input.color(color.purple, "Color", group=GRP_MA3) ma3 = ma(close, ma3_length, ma3_type) plot(ma3_enable ? ma3 : na, title="MA 3", color=ma3_color, linewidth=2, display=display.all) &#8203; GRP_MA4 = "Moving Average 4" ma4_enable = input.bool(false, "Enable MA 4", group=GRP_MA4) ma4_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA4) ma4_length = input.int(120, "Length", minval=1, group=GRP_MA4) ma4_color = input.color(color.black, "Color", group=GRP_MA4) ma4 = ma(close, ma4_length, ma4_type) plot(ma4_enable ? ma4 : na, title="MA 4", color=ma4_color, linewidth=2, display=display.all) &#8203; GRP_MA5 = "Moving Average 5" ma5_enable = input.bool(false, "Enable MA 5", group=GRP_MA5) ma5_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA5) ma5_length = input.int(240, "Length", minval=1, group=GRP_MA5) ma5_color = input.color(color.new(color.green, 20), "Color", group=GRP_MA5) ma5 = ma(close, ma5_length, ma5_type) plot(ma5_enable ? ma5 : na, title="MA 5", color=ma5_color, linewidth=1, display=display.all) &#8203; GRP_MA6 = "Moving Average 6" ma6_enable = input.bool(false, "Enable MA 6", group=GRP_MA6) ma6_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA6) ma6_length = input.int(400, "Length", minval=1, group=GRP_MA6) ma6_color = input.color(color.new(color.red, 20), "Color", group=GRP_MA6) ma6 = ma(close, ma6_length, ma6_type) plot(ma6_enable ? ma6 : na, title="MA 6", color=ma6_color, linewidth=1, display=display.all) &#8203; GRP_MA7 = "Moving Average 7" ma7_enable = input.bool(false, "Enable MA 7", group=GRP_MA7) ma7_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA7) ma7_length = input.int(600, "Length", minval=1, group=GRP_MA7) ma7_color = input.color(color.new(color.teal, 20), "Color", group=GRP_MA7) ma7 = ma(close, ma7_length, ma7_type) plot(ma7_enable ? ma7 : na, title="MA 7", color=ma7_color, linewidth=1, display=display.all) &#8203; // --- Bollinger Bands Settings --- // Bollinger Band 1 GRP_BB1 = "Bollinger Band 1" bb1_enable = input.bool(true, "Enable BB 1", group=GRP_BB1) bb1_source = input.source(close, "Source", group=GRP_BB1) bb1_length = input.int(20, "Length", minval=1, group=GRP_BB1) bb1_mult = input.float(2.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB1) bb1_basis_color = input.color(color.aqua, "Basis Color", group=GRP_BB1) // Basis line color bb1_upper_color = input.color(color.aqua, "Upper Color", group=GRP_BB1) // Upper line color bb1_lower_color = input.color(color.aqua, "Lower Color", group=GRP_BB1) // Lower line color bb1_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB1) // Line width for all BB lines bb1_fill_color = input.color(color.new(color.aqua, 90), "Fill Color", group=GRP_BB1) // Fill color bb1_hit_enable = input.bool(true, "Enable Hit Marks", group=GRP_BB1) // Enable/disable hit marks bb1_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB1) // Color for upper band hit bb1_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB1) // Color for lower band hit &#8203; bb1_basis = ta.sma(bb1_source, bb1_length) bb1_dev = bb1_mult * ta.stdev(bb1_source, bb1_length) bb1_upper = bb1_basis + bb1_dev bb1_lower = bb1_basis - bb1_dev &#8203; plot(bb1_enable ? bb1_basis : na, "BB1 Basis", color=bb1_basis_color, linewidth=bb1_linewidth) p1_bb1 = plot(bb1_enable ? bb1_upper : na, "BB1 Upper", color=bb1_upper_color, linewidth=bb1_linewidth) p2_bb1 = plot(bb1_enable ? bb1_lower : na, "BB1 Lower", color=bb1_lower_color, linewidth=bb1_linewidth) fill(p1_bb1, p2_bb1, color=bb1_enable ? bb1_fill_color : na, title="BB1 Fill") &#8203; // Plot shapes when candle hits BB1 (modified conditions to include equality) plotshape(bb1_hit_enable and high >= bb1_upper, style=shape.triangledown, location=location.abovebar, color=bb1_hit_color_upper, size=size.small, title="BB1 Upper Hit") plotshape(bb1_hit_enable and low <= bb1_lower, style=shape.triangleup, location=location.belowbar, color=bb1_hit_color_lower, size=size.small, title="BB1 Lower Hit") &#8203; &#8203; // Bollinger Band 2 GRP_BB2 = "Bollinger Band 2" bb2_enable = input.bool(false, "Enable BB 2", group=GRP_BB2) bb2_source = input.source(open, "Source", group=GRP_BB2) bb2_length = input.int(4, "Length", minval=1, group=GRP_BB2) bb2_mult = input.float(4.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB2) bb2_basis_color = input.color(color.fuchsia, "Basis Color", group=GRP_BB2) // Basis line color bb2_upper_color = input.color(color.fuchsia, "Upper Color", group=GRP_BB2) // Upper line color bb2_lower_color = input.color(color.fuchsia, "Lower Color", group=GRP_BB2) // Lower line color bb2_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB2) // Line width for all BB lines bb2_fill_color = input.color(color.new(color.fuchsia, 90), "Fill Color", group=GRP_BB2) // Fill color bb2_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB2) // Enable/disable hit marks bb2_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB2) // Color for upper band hit bb2_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB2) // Color for lower band hit &#8203; bb2_basis = ta.sma(bb2_source, bb2_length) bb2_dev = bb2_mult * ta.stdev(bb2_source, bb2_length) bb2_upper = bb2_basis + bb2_dev bb2_lower = bb2_basis - bb2_dev &#8203; plot(bb2_enable ? bb2_basis : na, "BB2 Basis", color=bb2_basis_color, linewidth=bb2_linewidth) p1_bb2 = plot(bb2_enable ? bb2_upper : na, "BB2 Upper", color=bb2_upper_color, linewidth=bb2_linewidth) p2_bb2 = plot(bb2_enable ? bb2_lower : na, "BB2 Lower", color=bb2_lower_color, linewidth=bb2_linewidth) fill(p1_bb2, p2_bb2, color=bb2_enable ? bb2_fill_color : na, title="BB2 Fill") &#8203; // Plot shapes when candle hits BB2 (modified conditions to include equality) plotshape(bb2_hit_enable and high >= bb2_upper, style=shape.triangledown, location=location.abovebar, color=bb2_hit_color_upper, size=size.small, title="BB2 Upper Hit") plotshape(bb2_hit_enable and low <= bb2_lower, style=shape.triangleup, location=location.belowbar, color=bb2_hit_color_lower, size=size.small, title="BB2 Lower Hit") &#8203; // Bollinger Band 3 GRP_BB3 = "Bollinger Band 3" bb3_enable = input.bool(false, "Enable BB 3", group=GRP_BB3) bb3_source = input.source(open, "Source", group=GRP_BB3) bb3_length = input.int(3, "Length", minval=1, group=GRP_BB3) bb3_mult = input.float(3.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB3) bb3_basis_color = input.color(color.lime, "Basis Color", group=GRP_BB3) // Basis line color bb3_upper_color = input.color(color.lime, "Upper Color", group=GRP_BB3) // Upper line color bb3_lower_color = input.color(color.lime, "Lower Color", group=GRP_BB3) // Lower line color bb3_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB3) // Line width for all BB lines bb3_fill_color = input.color(color.new(color.lime, 90), "Fill Color", group=GRP_BB3) // Fill color bb3_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB3) // Enable/disable hit marks bb3_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB3) // Color for upper band hit bb3_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB3) // Color for lower band hit &#8203; bb3_basis = ta.sma(bb3_source, bb3_length) bb3_dev = bb3_mult * ta.stdev(bb3_source, bb3_length) bb3_upper = bb3_basis + bb3_dev bb3_lower = bb3_basis - bb3_dev &#8203; plot(bb3_enable ? bb3_basis : na, "BB3 Basis", color=bb3_basis_color, linewidth=bb3_linewidth) p1_bb3 = plot(bb3_enable ? bb3_upper : na, "BB3 Upper", color=bb3_upper_color, linewidth=bb3_linewidth) p2_bb3 = plot(bb3_enable ? bb3_lower : na, "BB3 Lower", color=bb3_lower_color, linewidth=bb3_linewidth) fill(p1_bb3, p2_bb3, color=bb3_enable ? bb3_fill_color : na, title="BB3 Fill") &#8203; // Plot shapes when candle hits BB3 (modified conditions to include equality) plotshape(bb3_hit_enable and high >= bb3_upper, style=shape.triangledown, location=location.abovebar, color=bb3_hit_color_upper, size=size.small, title="BB3 Upper Hit") plotshape(bb3_hit_enable and low <= bb3_lower, style=shape.triangleup, location=location.belowbar, color=bb3_hit_color_lower, size=size.small, title="BB3 Lower Hit") 수정부탁드립니다
프로필 이미지
윤호석
2025-09-13
167
글번호 193981
지표
답변완료

부탁드립니다 항상 감사합니다

{========================================== Disparity Index + RSI (YesLanguage ver.) - DI = 100 * (src - SMA(src,L)) / SMA - scaledDI = 20*DI + 50 (RSI 스케일과 유사) - RSI = Wilder's RMA 방식 - RSI MA 옵션: None/SMA/BB/EMA/RMA/WMA/VWMA - Regular Bullish/Bearish Divergence 라벨 ==========================================} {----------- Inputs -----------} input : DI_Length(14); input : RSI_Length(14); input : MA_Type(1); { 0=None, 1=SMA, 2=SMA+BB, 3=EMA, 4=RMA, 5=WMA, 6=VWMA } input : MA_Len(14); input : BB_Mult(2.0); input : CalcDivergence(true); { 색상(플랫폼 팔레트에 맞게 필요 시 바꾸세요) } input : DiUpColor(Green), DiDnColor(Red); input : RsiColor(Magenta); input : BBColor(Green); input : LevelColor(Gray); {----------- Vars -----------} var : src(0), di(0), scaledDi(0), smaDI(0); var : rsi(0), chg(0), up(0), dn(0), upRMA(0), dnRMA(0); var : rsiMA(0), rsiBB_up(0), rsiBB_dn(0), rsiStDev(0); { 다이버전스용 } input : LB_Left(5), LB_Right(5); var : rsiPivotLow(0), rsiPivL_Bars(0), rsiPrevPivotLow(0); var : rsiPivotHigh(0), rsiPivH_Bars(0), rsiPrevPivotHigh(0); var : pxPivotLow(0), pxPrevPivotLow(0); var : pxPivotHigh(0), pxPrevPivotHigh(0); var : bullCond(false), bearCond(false); var : txBull(0), txBear(0); {----------- Source -----------} src = Close; { 필요 시 Open/High/Low 등으로 변경 가능 } {----------- Disparity Index -----------} smaDI = Average(src, DI_Length); if smaDI <> 0 then di = 100 * (src - smaDI) / smaDI else di = 0; scaledDi = 20 * di + 50; { 색상 선택 } var : diColor(0); diColor = IFF(scaledDi >= 50, DiUpColor, DiDnColor); Plot1(scaledDi, "Scaled DI", diColor); { DI(스케일드) } Plot2(50, "DI 50", LevelColor); { Pine의 hline(50) 대체 } {----------- RSI (Wilder RMA) -----------} chg = Close - Close[1]; up = MaxList(chg, 0); dn = MaxList(-chg, 0); /* RMA 구현: prev*(Len-1)/Len + x/Len */ if CurrentBar = 1 then begin upRMA = up; dnRMA = dn; end else begin upRMA = (upRMA[1] * (RSI_Length - 1) + up) / RSI_Length; dnRMA = (dnRMA[1] * (RSI_Length - 1) + dn) / RSI_Length; end; if dnRMA = 0 then rsi = 100 else if upRMA = 0 then rsi = 0 else rsi = 100 - (100 / (1 + upRMA / dnRMA)); Plot3(rsi, "RSI", RsiColor); /* RSI 레벨 라인 (70/60/50/40/30) */ Plot4(70, "RSI 70", LevelColor); Plot5(60, "RSI 60", LevelColor); Plot6(50, "RSI 50", LevelColor); Plot7(40, "RSI 40", LevelColor); Plot8(30, "RSI 30", LevelColor); {----------- RSI Smoothing MA / BB -----------} /* MA 선택 함수 대체: 플랫폼 내장 MA가 다르면 Average/EMA/WMA 등으로 매핑하세요 */ { SMA } if MA_Type = 1 or MA_Type = 2 then rsiMA = Average(rsi, MA_Len) else if MA_Type = 3 then { EMA } rsiMA = XAverage(rsi, MA_Len) else if MA_Type = 4 then { RMA(=SMMA) } begin if CurrentBar = 1 then rsiMA = rsi else rsiMA = (rsiMA[1] * (MA_Len - 1) + rsi) / MA_Len; end else if MA_Type = 5 then { WMA } rsiMA = WAverage(rsi, MA_Len) else if MA_Type = 6 then { VWMA (가중=거래량) } rsiMA = Summation(rsi * Volume, MA_Len) / Summation(Volume, MA_Len) else rsiMA = NaN; { MA 표시 } if MA_Type >= 1 then Plot9(rsiMA, "RSI_MA", Yellow); { BB (SMA + Bollinger Bands) } if MA_Type = 2 then begin rsiStDev = StandardDev(rsi, MA_Len, 1); { 1 = 표본/모수 선택은 환경 따라 조정 } rsiBB_up = rsiMA + rs_ 수정부탁드려요
프로필 이미지
윤호석
2025-09-13
133
글번호 193980
지표