Q&A 게시판 HOME > Q&A 게시판
작성자 : 예스스탁 작성일 : 2025-03-18 17:43:11 조회수 : 19
Re:수식문의


안녕하세요
예스스탁입니다.


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);


즐거운 하루되세요



>> 조선태 님이 쓴 글입니다.

>> 제목 : 수식문의안녕하세요. 
코인매매에 재미를 한참 붙이는 중입니다.
트레이딩뷰에 있는 지표 스크립트를 복사해서 붙여넣기 하면 예스트레이더에서도 사용 가능할 줄 알았는데,
안되네요. 혹시나 도움 주실 수 있는 분들이 계신가 하여 올립니다.
아래는 트레이딩뷰 스크립트 입니다. 예스트레이더코인에서 지표로 사용 할 수 있게 편집해 주실분 계신지요.
ut bot 이라는 지표이던데.. 혹시나 도움 받을 수 있는가 하여 올려봅니다. 감사합니다.

//@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")
목록 답변