커뮤니티

수식 변환좀 부탁드립니다.

프로필 이미지
로꼬로꼬
2025-02-27 22:52:19
467
글번호 188642
답변완료
안녕하세요 날씨가 봄에 가까워 지니 날씨가 조금 풀리고 있습니다. 오늘은 트뷰에서 사용중인 신호지표를 예스 수식으로 변환좀 부탁드리려 합니다. //@version=4 study(title="UT Bot Alerts", overlay = true) // Inputs a = input(1, title = "Key Vaule. 'This changes the sensitivity'") c = input(10, title = "ATR Period") h = input(false, title = "Signals from Heikin Ashi Candles") xATR = atr(c) nLoss = a * xATR src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close xATRTrailingStop = 0.0 xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss), iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss), iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss))) pos = 0 pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1, iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue ema = ema(src,1) above = crossover(ema, xATRTrailingStop) below = crossover(xATRTrailingStop, ema) buy = src > xATRTrailingStop and above sell = src < xATRTrailingStop and below barbuy = src > xATRTrailingStop barsell = src < xATRTrailingStop plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny) plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny) barcolor(barbuy ? color.green : na) barcolor(barsell ? color.red : na) alertcondition(buy, "UT Long", "UT Long") alertcondition(sell, "UT Short", "UT Short") 이 수식을 예스에서 이용가능하게 변환좀 부탁드립니다. 감사합니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-02-28 11:52:50

안녕하세요 예스스탁입니다. 올리신 수식은 강조식으로 작성해 차트에 적용하셔야 합니다. input : a(1); input : ATRP(10); input : ha(false); var : xATR(0),nLoss(0); var : xClose(0),xHigh(0),xLow(0),xOpen(0),src(0); var : xATRTrailingStop(0),ps(0),xcolor(0); xATR = atr(ATRP); nLoss = a * xATR; if index == 0 then { xClose = (O+H+L+C)/4; xOpen = open; xHigh = MaxList( high, xOpen, xClose); xLow = MinList( low, xOpen,xClose); } else { xClose = (O+H+L+C)/4; xOpen = (xOpen [1] + xClose [1])/2 ; xHigh = MaxList(High, xOpen, xClose) ; xLow = MinList(Low, xOpen, xClose) ; } if ha == False Then src = close; Else src = xClose; var1 = IFf(IsNan(xATRTrailingStop[1]) ==true,0,xATRTrailingStop[1]); xATRTrailingStop =iff(src > var1 and src[1] > var1, max(var1, src - nLoss), iff(src < var1 and src[1] < var1, min(var1, src + nLoss), iff(src > var1, src - nLoss, src + nLoss))); ps = iff(src[1] < var1 and src > var1, 1, iff(src[1] > var1 and src < var1, -1, IFf(IsNaN(ps[1])==true,0,ps[1]))); xcolor = iff(ps == -1 , red, IFf(ps == 1 , green , blue)); var : emv(0),above(False),below(False); var : b(False),s(False),barbuy(False),barsell(False),tx(0); emv = ema(src,1); above = CrossUp(emv, xATRTrailingStop); below = CrossUp(xATRTrailingStop, emv); b = src > xATRTrailingStop and above; s = src < xATRTrailingStop and below; barbuy = src > xATRTrailingStop; barsell = src < xATRTrailingStop ; if b == true Then { tx = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Green); } if s == true Then { tx = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Red); } if barbuy == true Then PlotPaintBar(H,L,"강조",Green); if barsell == true Then PlotPaintBar(H,L,"강조",Red); 즐거운 하루되세요 > 로꼬로꼬 님이 쓴 글입니다. > 제목 : 수식 변환좀 부탁드립니다. > 안녕하세요 날씨가 봄에 가까워 지니 날씨가 조금 풀리고 있습니다. 오늘은 트뷰에서 사용중인 신호지표를 예스 수식으로 변환좀 부탁드리려 합니다. //@version=4 study(title="UT Bot Alerts", overlay = true) // Inputs a = input(1, title = "Key Vaule. 'This changes the sensitivity'") c = input(10, title = "ATR Period") h = input(false, title = "Signals from Heikin Ashi Candles") xATR = atr(c) nLoss = a * xATR src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close xATRTrailingStop = 0.0 xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss), iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss), iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss))) pos = 0 pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1, iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue ema = ema(src,1) above = crossover(ema, xATRTrailingStop) below = crossover(xATRTrailingStop, ema) buy = src > xATRTrailingStop and above sell = src < xATRTrailingStop and below barbuy = src > xATRTrailingStop barsell = src < xATRTrailingStop plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny) plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny) barcolor(barbuy ? color.green : na) barcolor(barsell ? color.red : na) alertcondition(buy, "UT Long", "UT Long") alertcondition(sell, "UT Short", "UT Short") 이 수식을 예스에서 이용가능하게 변환좀 부탁드립니다. 감사합니다.