커뮤니티

수식전환 요청드립니다.

프로필 이미지
고박사122
2024-12-06 05:41:21
582
글번호 186004
답변완료
안녕하세요. 아래의 트레이딩뷰 지표수식을 예스트레이더 형식으로 변환을 요청드립니다. 감사합니다. (첨부파일 참조해 주십시오) showSignal = input(title="Show Signal ?", type=input.bool, defval=true) signalType = input(title="Signal Smoothing Type", defval="SMA", options=["EMA", "SMA"]) signalLength = input(title="Signal Smoothing Length", type=input.integer, defval=21) src = input(title="Source", type=input.source, defval=close) highlightCrossovers = input(title="Highlight Crossovers ?", type=input.bool, defval=false) applyFilling = input(title="Apply Ribbon Filling ?", type=input.bool, defval=true) signal = signalType == "EMA" ? ema(pvt, signalLength) : sma(pvt, signalLength) trendColor = pvt > signal ? #0ebb23 : color.red pvtColor = applyFilling ? trendColor : #0094ff signalColor = applyFilling ? trendColor : #ff6a00 pvtPlot = plot(pvt, title="PVT", linewidth=2, color=pvtColor, transp=0) signalPlot = plot(showSignal ? signal : na, title="Signal", color=signalColor, transp=0) transparent = color.new(color.white, 100) fillColor = applyFilling ? trendColor : transparent fill(pvtPlot, signalPlot, color=fillColor, transp=70) buyAlert = crossover(pvt, signal) sellAlert = crossunder(pvt, signal) plotshape(buyAlert and highlightCrossovers ? pvt : na, title="Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) plotshape(sellAlert and highlightCrossovers ? pvt : na, title="Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) alertcondition(buyAlert, title="Alert: Buy", message="Buy Symbol: {{exchange}}:{{ticker}} Price: {{close}}") alertcondition(sellAlert, title="Alert: Sell", message="Sell Symbol: {{exchange}}:{{ticker}} Price: {{close}}")
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-12-06 15:35:10

안녕하세요 예스스탁입니다. input : signalType(1);#1:EMA or 2: SMA input : signalLength(21); var : src(0),signal(0); var : trendColor(0),tx(0); src = close; signal = iff(signalType == 1 , ema(pvt, signalLength) , ma(pvt, signalLength)); trendColor = iff(pvt > signal , Green , red); plot1(pvt, "PVT",trendColor); plot2(signal,"Signal",trendColor); if CrossUp(pvt, signal) Then { tx = Text_New_Self(sDate,sTime,PVT,"Crossover"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Red); } if CrossDown(pvt, signal) Then { tx = Text_New_Self(sDate,sTime,PVT,"Crossunder"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Blue); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 수식전환 요청드립니다. > 안녕하세요. 아래의 트레이딩뷰 지표수식을 예스트레이더 형식으로 변환을 요청드립니다. 감사합니다. (첨부파일 참조해 주십시오) showSignal = input(title="Show Signal ?", type=input.bool, defval=true) signalType = input(title="Signal Smoothing Type", defval="SMA", options=["EMA", "SMA"]) signalLength = input(title="Signal Smoothing Length", type=input.integer, defval=21) src = input(title="Source", type=input.source, defval=close) highlightCrossovers = input(title="Highlight Crossovers ?", type=input.bool, defval=false) applyFilling = input(title="Apply Ribbon Filling ?", type=input.bool, defval=true) signal = signalType == "EMA" ? ema(pvt, signalLength) : sma(pvt, signalLength) trendColor = pvt > signal ? #0ebb23 : color.red pvtColor = applyFilling ? trendColor : #0094ff signalColor = applyFilling ? trendColor : #ff6a00 pvtPlot = plot(pvt, title="PVT", linewidth=2, color=pvtColor, transp=0) signalPlot = plot(showSignal ? signal : na, title="Signal", color=signalColor, transp=0) transparent = color.new(color.white, 100) fillColor = applyFilling ? trendColor : transparent fill(pvtPlot, signalPlot, color=fillColor, transp=70) buyAlert = crossover(pvt, signal) sellAlert = crossunder(pvt, signal) plotshape(buyAlert and highlightCrossovers ? pvt : na, title="Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0) plotshape(sellAlert and highlightCrossovers ? pvt : na, title="Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0) alertcondition(buyAlert, title="Alert: Buy", message="Buy Symbol: {{exchange}}:{{ticker}} Price: {{close}}") alertcondition(sellAlert, title="Alert: Sell", message="Sell Symbol: {{exchange}}:{{ticker}} Price: {{close}}")