답변완료
228766 재문의
안녕하세요? 지난번 문의에 대한 답변 중 앞부분이 잘 이해가 안갑니다. 왜 이렇게 수식이 복잡해져야 하는지도 잘 이해가 안가서요... 이해가 잘 안가는 그 앞부분을 아래에 복사해 놓았습니다.특히 sDate, sDate[1], sTime, sTime[1], Bdate?, Bdate[1]? 이런 것들의 정의를 어디서 볼 수 있나요?뭐 느낌은 있는데, 정확한 정의를 잘 모르겠습니다.참 그리고, 제대로 작동하지 않습니다. 그림을 보시면, 아래의 지표에서 파란색이 매수신호, 빨간색이 매도신도, 회색은 무포로 있어야 하는 신호인데, N = 9 즉, 하루 9번의 매매를 허락했는데도 매매횟수가 턱없이 모자랍니다. 이 부분도 수정 부탁드립니다.input : N(3),st(2),tp(3),tl(1),t2(2); input : starttime(92000),Endtime(144000),Xtime(152000); var : Tcond(False),TT(0),T1(0),entry(0); TT = TotalTrades; IF Xtime > starttime Then SetStopEndofday(Xtime); Else { if sDate != sDate[1] Then SetStopEndofday(Xtime); } if (sdate != sDate[1] and sTime >= Endtime) or (sdate == sDate[1] and sTime >= Endtime and sTime[1] < Endtime) Then { Tcond = False; } if (sdate != sDate[1] and sTime >= starttime) or (sdate == sDate[1] and sTime >= starttime and sTime[1] < starttime) Then { Tcond = true; T1 = TT[1]; IF Xtime <= starttime Then { SetStopEndofday(0); } } entry = TT-T1+IFF(MarketPosition != 0,1,0); 요 부분에 대해서 간단히 주석이나 설명 좀 부탁드리고 싶습니다.감사합니다.
답변완료
변환 부탁 드립니다.
// © Zeiierman { //@version=6 indicator('Dynamic Swing Anchored VWAP (Zeiierman)', overlay = true, max_bars_back = 5000, max_labels_count = 500, max_polylines_count = 100) //~~}// ~~ Tooltips { var string t1 = "Number of bars used to detect swing highs and lows. Larger values identify bigger, more significant swings but react slower. Smaller values detect more frequent swings but may produce more noise." var string t2 = "Controls how quickly the VWAP adjusts to new price action. Lower values make the VWAP react faster (tighter to price), higher values make it smoother and slower to change." var string t3 = "When enabled, the VWAP reaction speed changes automatically based on market volatility. High volatility shortens the tracking period (more responsive), low volatility lengthens it (smoother)." var string t4 = "Controls how strongly volatility influences the VWAP reaction speed. Values above 1 increase the effect of volatility changes; values below 1 make it less sensitive to volatility." var string t5 = "Color used for swing high/low labels drawn on the chart to indicate pivot points." var string t6 = "Color used for swing low labels when marking pivot points." var string t7 = "Color used for VWAP lines when in an uptrend." var string t8 = "Color used for VWAP lines when in a downtrend." var string t9 = "Width of the VWAP lines drawn on the chart. Larger values make the lines thicker and more visible." //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ Inputs { prd = input.int(50, title='Swing Period', minval=2, group='Swing Points', tooltip=t1) baseAPT = input.float(20, 'Adaptive Price Tracking', minval=1, step=1, group='Swing Points', tooltip=t2) useAdapt = input.bool(false, 'Adapt APT by ATR ratio', group='Swing Points', tooltip=t3) volBias = input.float(10.0, 'Volatility Bias', minval=0.1, step=0.1, group='Swing Points', tooltip=t4)highS = input.color(color.lime, title="Swing Labels", group="Style", inline="Swing", tooltip=t5) lowS = input.color(color.red, title="", group="Style", inline="Swing", tooltip=t6) S = input.color(color.lime, title="VWAP Lines", group="Style", inline="VWAP", tooltip=t7) R = input.color(color.red, title="", group="Style", inline="VWAP", tooltip=t8) xx = input.int(2, minval=1, title="", group="Style", inline="VWAP", tooltip=t9) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ Global Variable { b = bar_index //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ PIVOTS Variables { var ph = float(na) var pl = float(na) var phL = b var plL = b var lab = label(na) var prev = float(na)ph := ta.highestbars(high, prd) == 0 ? high : ph pl := ta.lowestbars(low, prd) == 0 ? low : pl phL := ta.highestbars(high, prd) == 0 ? b : phL plL := ta.lowestbars(low, prd) == 0 ? b : plL dir = phL > plL ? 1 : -1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ Adaptation { atrLen = 50 atr = ta.atr(atrLen) atrAvg = ta.rma(atr, atrLen) ratio = atrAvg > 0 ? atr / atrAvg : 1.0aptRaw = useAdapt ? baseAPT / math.pow(ratio, volBias) : baseAPT aptClamped = math.max(5.0, math.min(300.0, aptRaw)) aptSeries = math.round(aptClamped)// alpha from APT (half-life -> EWMA alpha) alphaFromAPT(apt) => decay = math.exp(-math.log(2.0) / math.max(1.0, apt)) 1.0 - decay //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ VWAP Variables { var p = hlc3 * volume var vol = volume type dataPoints array<chart.point> points polyline poly = navar vwap = dataPoints.new(array.new<chart.point>()) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}// ~~ Main { if dir != dir[1] x = dir > 0 ? plL : phL y = dir > 0 ? pl : ph loc = dir > 0 ? label.style_label_up : label.style_label_down col = dir > 0 ? highS : lowS txt = dir > 0 and pl < prev ? 'LL' : dir > 0 and pl > prev ? 'HL' : dir < 0 and ph < prev ? 'LH' : dir < 0 and ph > prev ? 'HH' : '' label.new(x, y, text=txt, style=loc, color=color.new(col, 20), textcolor=color.white) prev := dir > 0 ? ph[1] : pl[1] barsback = b - x p := y * volume[barsback] vol := volume[barsback] vap = p / vol vwap.poly.delete() polyline.new(vwap.points, false, false, line_color = dir < 0 ? R : S, line_width = xx) vwap.points.clear() for i = barsback to 0 by 1 apt_i = aptSeries[i] alpha = alphaFromAPT(apt_i) pxv = hlc3[i] * volume[i] v_i = volume[i] p := (1.0 - alpha) * p + alpha * pxv vol := (1.0 - alpha) * vol + alpha * v_i vappe = vol > 0 ? p / vol : na vwap.points.push(chart.point.from_index(b - i, vappe)) vwap.poly := polyline.new(vwap.points, false, false, line_color = dir < 0 ? R : S, line_width = xx)else apt_0 = aptSeries alpha = alphaFromAPT(apt_0) pxv = hlc3 * volume v0 = volume p := (1.0 - alpha) * p + alpha * pxv vol := (1.0 - alpha) * vol + alpha * v0 vap = vol > 0 ? p / vol : na vwap.poly.delete() vwap.points.push(chart.point.from_index(b, vap)) vwap.poly := polyline.new(vwap.points, false, false, line_color = dir > 0 ? R : S, line_width = xx) //~~ }
2025-12-09
145
글번호 228815
지표
답변완료
변환 부탁 드립니다.
//@version=5indicator("ALMA Smoothed Gaussian Moving Average", shorttitle = "ASGMA", overlay=true)//ALMA Smoothingsrc = input(close, title='Source', group = "ALMA Smoothing")smooth = input.int(1, title='Smoothing', minval=1, group = "ALMA Smoothing")length1 = input.int(25, title='Lookback', minval=1, group = "ALMA Smoothing")offset = 0.85sigma1 = 7pchange = ta.change(src, smooth) / src * 100avpchange = ta.alma(pchange, length1, offset, sigma1)//RSIrsi = ta.rsi(close, 14)rsiL = rsi > rsi[1]rsiS = rsi < rsi[1]//Chande Momentumlength11 = 9src1 = closemomm = ta.change(src1)f1(m) => m >= 0.0 ? m : 0.0f2(m) => m >= 0.0 ? 0.0 : -mm1 = f1(momm)m2 = f2(momm)sm1 = math.sum(m1, length11)sm2 = math.sum(m2, length11)percent(nom, div) => 100 * nom / divchandeMO = percent(sm1-sm2, sm1+sm2)cL = chandeMO > chandeMO[1]cS = chandeMO < chandeMO[1]//GAMA credit to author: © LeafAlgo https://www.tradingview.com/v/th7NZUPM/length = input.int(14, minval=1, title="Length", group = "Gaussian Adaptive Moving Average")adaptive = input.bool(true, title="Adaptive Parameters", group = "Gaussian Adaptive Moving Average")volatilityPeriod = input.int(20, minval=1, title="Volatility Period", group = "Gaussian Adaptive Moving Average")// Calculate Gaussian Moving Averagegma = 0.0sumOfWeights = 0.0sigma = adaptive ? ta.stdev(close, volatilityPeriod) : input.float(1.0, minval=0.1, title="Standard Deviation", group = "Gaussian Adaptive Moving Average")for i = 0 to length - 1 weight = math.exp(-math.pow(((i - (length - 1)) / (2 * sigma)), 2) / 2) value = ta.highest(avpchange, i + 1) + ta.lowest(avpchange, i + 1) gma := gma + (value * weight) sumOfWeights := sumOfWeights + weightgma := (gma / sumOfWeights) / 2gma:= ta.ema(gma, 7)gmaColor = avpchange >= gma ? color.rgb(0, 161, 5) : color.rgb(215, 0, 0)// Color bars based on signals until the next signal occursvar int currentSignal = 0currentSignal := avpchange >= gma ? 1 : -1//le_final ? -1 : currentSignalvar color barColor = naif currentSignal == 1 barColor := color.rgb(0, 186, 6)else if currentSignal == -1 barColor := color.rgb(176, 0, 0)barcolor(barColor)plotcandle(open, high, low, close, "Bar Color", barColor, barColor, bordercolor = barColor)//Plottingema = ta.ema(close, 7)plot(ema, color=gmaColor, linewidth=3, title="Gaussian Moving Average")plotshape(ta.crossover(avpchange,gma) and barstate.isconfirmed, "Buy Signal", text = "B", textcolor = color.white, style = shape.labelup, location = location.belowbar, color = color.rgb(0, 161, 5), offset = -1)plotshape(ta.crossunder(avpchange,gma) and barstate.isconfirmed, "Sell Signal", text = "S", textcolor = color.white, style = shape.labeldown, location = location.abovebar, color = color.rgb(215, 0, 0), offset = -1)bgcolor(ta.crossover(avpchange,gma) and barstate.isconfirmed and rsiL and cL ? color.rgb(0, 162, 5, 85): na, offset = -1)bgcolor(ta.crossunder(avpchange,gma) and barstate.isconfirmed and rsiS and cS ? color.rgb(207, 0, 0, 85): na, offset = -1)barcolor(gmaColor)alertcondition(ta.crossover(avpchange,gma) and barstate.isconfirmed, title="Buy Signal", message="Go Long! {{exchange}}:{{ticker}}")alertcondition(ta.crossunder(avpchange,gma) and barstate.isconfirmed, title="Sell Signal", message="Go Short! {{exchange}}:{{ticker}}")
2025-12-09
131
글번호 228811
지표
답변완료
지표 부탁드립니다
1. 다음은 ZL + 7BW 키움지표수식입니다. 참고하여 , 예스트레이더 지표 부탁드려요. (수식1) ZL (파랑)A=LinearRegressionValue(C,50,0); A1=LinearRegressionValue(A,50,0); eq= A-A1; z =A+eq; Z1=(Z-lowest(Z,기간1))/(highest(Z,기간1)-lowest(Z,기간1))*100; (수식2) 7BW (빨강) B1=if(eavg(C,12)-eavg(C,26) > eavg(eavg(C,12)-eavg(C,26),9), 1,-1); B2=if(C > avg(C, 20), 1, -1); B3=if((C - C(12)) / C(12) * 100 > 0, 1, -1); B4=if(eavg((C-lowest(L, 5)) / (highest(H, 5) - lowest(L, 5)) * 100, 3)>50, 1, -1); B5=If(CCI(20) > 0,1,-1); B6=If(C > SAR(0.02,0.2),1,-1); B7=If((eavg(sum(((C -L)-(H- C))/ (H-L)*V), 3)-eavg(sum(((C -L)-(H- C))/(H-L)*V), 10))>0,1,-1); A=B1+B2+B3+B4+B5+B6+B7; BB=eavg(A,9); BB1=(BB-lowest(BB,기간1))/(highest(BB,기간1)-lowest(BB,기간1))*100; - 지표조건설정 기간1 : 60- 수식2) 7BW 기준선 (검정) 20 이하 침체 (바탕색 파랑) 80 이상 과열 (바탕색 빨강)2. 다음은 S 9 17 26 키움지표수식입니다. 참고하여 , 예스트레이더 지표 부탁드려요. (수식1) S9 Sum(C-lowest(L,기간1),S기간) / Sum((highest(H,기간1)-lowest(L,기간1)),S기간) * 100 (수식2) S17 Sum(C-lowest(L,기간2),S기간) / Sum((highest(H,기간2)-lowest(L,기간2)),S기간) * 100 (수식3) S26 Sum(C-lowest(L,기간3),S기간) / Sum((highest(H,기간3)-lowest(L,기간3)),S기간) * 100 - 지표조건설정 기간1 : 9 (녹색)기간2 : 17 (파랑) 기간3 : 26 (빨강) S기간 : 5- 기준선 (검정) 20 : 침체 80 : 과열