커뮤니티

YesStock으로 변환 부탁드립니다.

프로필 이미지
하날랑
2024-12-05 14:45:29
480
글번호 185982
답변완료
항상 친절하고 빠른 답변에 감사를 드립니다. 다음의 트레이딩뷰의 코딩을 YesStock에 맞게 변환을 부탁드립니다. //indicator(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 = ta.atr(c) nLoss = a * xATR srcu = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close xATRTrailingStop = 0.0 iff_1 = srcu > nz(xATRTrailingStop[1], 0) ? srcu - nLoss : srcu + nLoss iff_2 = srcu < nz(xATRTrailingStop[1], 0) and srcu[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), srcu + nLoss) : iff_1 xATRTrailingStop := srcu > nz(xATRTrailingStop[1], 0) and srcu[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), srcu - nLoss) : iff_2 pos = 0 iff_3 = srcu[1] > nz(xATRTrailingStop[1], 0) and srcu < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0) pos := srcu[1] < nz(xATRTrailingStop[1], 0) and srcu > nz(xATRTrailingStop[1], 0) ? 1 : iff_3 xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue ema = ta.ema(srcu, 1) above = ta.crossover(ema, xATRTrailingStop) below = ta.crossover(xATRTrailingStop, ema) buy = srcu > xATRTrailingStop and above sell = srcu < xATRTrailingStop and below barbuy = srcu > xATRTrailingStop barsell = srcu < xATRTrailingStop plotshape(buy, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny) plotshape(sell, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 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
프로필 이미지

예스스탁 예스스탁 답변

2024-12-05 16:20:04

안녕하세요 예스스탁입니다. input : aa(1),cc(10),hh(1);#1: heikinashi종가, 2: 봉종가 var : xatr(0),nloss(0),xATRTrailingStop(0); var : xOpen(0),xClose(0),xhigh(0),xlow(0),src(0),pos(0),xcolor(0),emav(0),tx(0); xATR = atr(cc); nLoss = aa * xATR; if index == 0 then { xOpen = open; xClose = (O+H+L+C)/4; 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) ; } src = iff(hh == 1 , Xclose , close); 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))); pos = iff(src[1] < var1 and src > var1, 1, iff(src[1] > var1 and src < var1, -1, iff(isnan(pos[1]) == true, 0,pos[1]))); xcolor = iff(pos == -1 , red , iff(pos == 1 , green , blue)); emav = ema(src,1); Plot1(xATRTrailingStop); if src > xATRTrailingStop and CrossUp(emav, xATRTrailingStop) Then { tx = text_new(sDate,sTime,L,"Buy"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Red); } if src < xATRTrailingStop and CrossUp(xATRTrailingStop, emav) Then { tx = text_new(sDate,sTime,H,"Sell"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Red); } 즐거운 하루되세요 > 하날랑 님이 쓴 글입니다. > 제목 : YesStock으로 변환 부탁드립니다. > 항상 친절하고 빠른 답변에 감사를 드립니다. 다음의 트레이딩뷰의 코딩을 YesStock에 맞게 변환을 부탁드립니다. //indicator(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 = ta.atr(c) nLoss = a * xATR srcu = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off) : close xATRTrailingStop = 0.0 iff_1 = srcu > nz(xATRTrailingStop[1], 0) ? srcu - nLoss : srcu + nLoss iff_2 = srcu < nz(xATRTrailingStop[1], 0) and srcu[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), srcu + nLoss) : iff_1 xATRTrailingStop := srcu > nz(xATRTrailingStop[1], 0) and srcu[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), srcu - nLoss) : iff_2 pos = 0 iff_3 = srcu[1] > nz(xATRTrailingStop[1], 0) and srcu < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0) pos := srcu[1] < nz(xATRTrailingStop[1], 0) and srcu > nz(xATRTrailingStop[1], 0) ? 1 : iff_3 xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue ema = ta.ema(srcu, 1) above = ta.crossover(ema, xATRTrailingStop) below = ta.crossover(xATRTrailingStop, ema) buy = srcu > xATRTrailingStop and above sell = srcu < xATRTrailingStop and below barbuy = srcu > xATRTrailingStop barsell = srcu < xATRTrailingStop plotshape(buy, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny) plotshape(sell, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 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')