커뮤니티

문의 드립니다.

프로필 이미지
신대륙발견
2025-09-07 23:54:21
64
글번호 193755
답변완료
const string calcGroup = 'Calculation' length = input.int(22, title = 'ATR Period', group = calcGroup) mult = input.float(3.0, step = 0.1, title = 'ATR Multiplier', group = calcGroup) useClose = input.bool(true, title = 'Use Close Price for Extremums', group = calcGroup) const string visualGroup = 'Visuals' showLabels = input.bool(true, title = 'Show Buy/Sell Labels', group = visualGroup) highlightState = input.bool(true, title = 'Highlight State', group = visualGroup) const string alertGroup = 'Alerts' awaitBarConfirmation = input.bool(true, title = 'Await Bar Confirmation', group = alertGroup) //--- atr = mult * ta.atr(length) longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atr longStopPrev = nz(longStop[1], longStop) longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atr shortStopPrev = nz(shortStop[1], shortStop) shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop var int dir = 1 dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir const color textColor = color.white const color longColor = color.green const color shortColor = color.red const color longFillColor = color.new(color.green, 85) const color shortFillColor = color.new(color.red, 85) buySignal = dir == 1 and dir[1] == -1 longStopPlot = plot(dir == 1 ? longStop : na, title = 'Long Stop', style = plot.style_linebr, linewidth = 2, color = longColor) plotshape(buySignal ? longStop : na, title = 'Long Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = longColor) plotshape(buySignal and showLabels ? longStop : na, title = 'Buy Label', text = 'Buy', location = location.absolute, style = shape.labelup, size = size.tiny, color = longColor, textcolor = textColor) sellSignal = dir == -1 and dir[1] == 1 shortStopPlot = plot(dir == 1 ? na : shortStop, title = 'Short Stop', style = plot.style_linebr, linewidth = 2, color = shortColor) plotshape(sellSignal ? shortStop : na, title = 'Short Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = shortColor) plotshape(sellSignal and showLabels ? shortStop : na, title = 'Sell Label', text = 'Sell', location = location.absolute, style = shape.labeldown, size = size.tiny, color = shortColor, textcolor = textColor) midPricePlot = plot(ohlc4, title = '', display = display.none, editable = false) fill(midPricePlot, longStopPlot, title = 'Long State Filling', color = (highlightState and dir == 1 ? longFillColor : na)) fill(midPricePlot, shortStopPlot, title = 'Short State Filling', color = (highlightState and dir == -1 ? shortFillColor : na)) await = awaitBarConfirmation ? barstate.isconfirmed : true alertcondition(dir != dir[1] and await, title = 'CE Direction Change', message = 'Chandelier Exit has changed direction, {{exchange}}:{{ticker}}') alertcondition(buySignal and await, title = 'CE Buy', message = 'Chandelier Exit Buy, {{exchange}}:{{ticker}}') alertcondition(sellSignal and await, title = 'CE Sell', message = 'Chandelier Exit Sell, {{exchange}}:{{ticker}}') 트레이딩뷰 수식인데 예스 지표로 만들어주시고 매수/매도 신호를 예스 시스템식으로 만들어주세요.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-09-08 14:18:24

안녕하세요 예스스탁입니다. input : length(22); input : mult(3.0); input : useClose(1);#1:true,2:False input : showLabels(true); input : highlightState(true); input : awaitBarConfirmation(true); var : alpha(0),A(0),atr(0); var : longStop(0),longStopPrev(0),shortStop(0),shortStopPrev(0); alpha = 1 / length ; A = IFf(IsNan(A[1]) == true, ma(TrueRange,length) , alpha * TrueRange + (1 - alpha) * IFf(isnan(A[1])==true,0,A[1])); atr = mult * A; longStop = IFf(useClose == 1 , highest(close, length) , highest(h,length)) - atr; longStopPrev = iff(isnan(longStop[1])==true,longStop,longStop[1]); longStop = iff(close[1] > longStopPrev , max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1 , lowest(close, length) , lowest(l,length)) + atr; shortStopPrev = iff(IsNan(shortStop[1])==true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); var : dir(1); dir = iff(close > shortStopPrev , 1 , IFf( close < longStopPrev , -1 , dir)); var : textColor(Black); var : longColor(green); var : shortColor(red); var : longFillColor(green); var : shortFillColor(red); var : buySignal(False),sellSignal(False),tx(0); buySignal = dir == 1 and dir[1] == -1; sellSignal = dir == -1 and dir[1] == 1; if buySignal == true Then { Buy(); } if sellSignal == true Then { Sell(); } 즐거운 하루되세요 > 신대륙발견 님이 쓴 글입니다. > 제목 : 문의 드립니다. > const string calcGroup = 'Calculation' length = input.int(22, title = 'ATR Period', group = calcGroup) mult = input.float(3.0, step = 0.1, title = 'ATR Multiplier', group = calcGroup) useClose = input.bool(true, title = 'Use Close Price for Extremums', group = calcGroup) const string visualGroup = 'Visuals' showLabels = input.bool(true, title = 'Show Buy/Sell Labels', group = visualGroup) highlightState = input.bool(true, title = 'Highlight State', group = visualGroup) const string alertGroup = 'Alerts' awaitBarConfirmation = input.bool(true, title = 'Await Bar Confirmation', group = alertGroup) //--- atr = mult * ta.atr(length) longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atr longStopPrev = nz(longStop[1], longStop) longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atr shortStopPrev = nz(shortStop[1], shortStop) shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop var int dir = 1 dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir const color textColor = color.white const color longColor = color.green const color shortColor = color.red const color longFillColor = color.new(color.green, 85) const color shortFillColor = color.new(color.red, 85) buySignal = dir == 1 and dir[1] == -1 longStopPlot = plot(dir == 1 ? longStop : na, title = 'Long Stop', style = plot.style_linebr, linewidth = 2, color = longColor) plotshape(buySignal ? longStop : na, title = 'Long Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = longColor) plotshape(buySignal and showLabels ? longStop : na, title = 'Buy Label', text = 'Buy', location = location.absolute, style = shape.labelup, size = size.tiny, color = longColor, textcolor = textColor) sellSignal = dir == -1 and dir[1] == 1 shortStopPlot = plot(dir == 1 ? na : shortStop, title = 'Short Stop', style = plot.style_linebr, linewidth = 2, color = shortColor) plotshape(sellSignal ? shortStop : na, title = 'Short Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = shortColor) plotshape(sellSignal and showLabels ? shortStop : na, title = 'Sell Label', text = 'Sell', location = location.absolute, style = shape.labeldown, size = size.tiny, color = shortColor, textcolor = textColor) midPricePlot = plot(ohlc4, title = '', display = display.none, editable = false) fill(midPricePlot, longStopPlot, title = 'Long State Filling', color = (highlightState and dir == 1 ? longFillColor : na)) fill(midPricePlot, shortStopPlot, title = 'Short State Filling', color = (highlightState and dir == -1 ? shortFillColor : na)) await = awaitBarConfirmation ? barstate.isconfirmed : true alertcondition(dir != dir[1] and await, title = 'CE Direction Change', message = 'Chandelier Exit has changed direction, {{exchange}}:{{ticker}}') alertcondition(buySignal and await, title = 'CE Buy', message = 'Chandelier Exit Buy, {{exchange}}:{{ticker}}') alertcondition(sellSignal and await, title = 'CE Sell', message = 'Chandelier Exit Sell, {{exchange}}:{{ticker}}') 트레이딩뷰 수식인데 예스 지표로 만들어주시고 매수/매도 신호를 예스 시스템식으로 만들어주세요.