예스스탁
예스스탁 답변
2025-05-09 11:12:35
안녕하세요
예스스탁입니다.
1
input : nATRPeriod(5);
input : nATRMultip(3.5);
var : xATR(0),nLoss(0),xATRTrailingStop(0),ps(0),nz(0),color(0);
xATR = atr(nATRPeriod);
nLoss = nATRMultip * xATR;
nz = iff(xATRTrailingStop[1] == true,0,xATRTrailingStop[1]);
xATRTrailingStop = iff(close > nz and close[1] > nz, max(nz, close - nLoss),
iff(close < nz and close[1] < nz, min(nz, close + nLoss),
iff(close > nz, close - nLoss, close + nLoss)));
ps = iff(close[1] < nz and close > nz, 1,
iff(close[1] > nz and close < nz, -1, iff(isnan(ps[1]) ==true, 0,ps[1]))) ;
color = iff(ps == -1 , red, iff(ps == 1 , green , blue));
plot1(xATRTrailingStop, "ATR Trailing Stop",color);
2
input : fractalPeriods(2);
var : bullFractal(0),bearFractal(0),tx(0);
if SwingHigh(1,h,fractalPeriods,fractalPeriods,fractalPeriods+fractalPeriods+1) != -1 Then
{
bullFractal = h[fractalPeriods];
tx = Text_New(sDate[fractalPeriods],sTime[fractalPeriods],bullFractal,"▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Green);
}
if Swinglow(1,l,fractalPeriods,fractalPeriods,fractalPeriods+fractalPeriods+1) != -1 Then
{
bearFractal = l[fractalPeriods];
tx = Text_New(sDate[fractalPeriods],sTime[fractalPeriods],bearFractal,"▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Red);
}
즐거운 하루되세요
> 해암 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래의 트레이딩뷰수식을 변환부탁드립니다.
1
================
nATRPeriod = input(5)
nATRMultip = input(3.5)
xATR = atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos = iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
color = pos == -1 ? red: pos == 1 ? green : blue
plot(xATRTrailingStop, color=color, title="ATR Trailing Stop")
==================
2.
=================
ractalPeriods = input(title="Fractal Periods", defval=2, minval=1, type=integer)
bullFractal = pivothigh(fractalPeriods, fractalPeriods)
bearFractal = pivotlow(fractalPeriods, fractalPeriods)
plotchar(bullFractal?true:na, title="Bull Fractal", location=location.abovebar, offset=-fractalPeriods, color=green, transp=0, size=size.tiny, char='⮝')
plotchar(bearFractal?true:na, title="Bear Fractal", location=location.belowbar, offset=-fractalPeriods, color=red, transp=0, size=size.tiny, char="⮟")
======================
감사합니다. 수고하세요!!!