예스스탁
예스스탁 답변
2024-11-12 16:33:21
안녕하세요
예스스탁입니다.
1. 지표
input : ATRperiod(5);
input : BBperiod(21);
input : BBdeviation(1.00);
input : UseATRfilter(1); // false = 0, true = 1
var : FollowLine(0),BBSignal(0);
var : BBUpper(0),BBLower(0),atrValue(0),iTrend(0),lineColor(0);
BBUpper = ma(close, BBperiod) + std(close, BBperiod) * BBdeviation;
BBLower = ma(close, BBperiod) - std(close, BBperiod) * BBdeviation;
atrValue = atr(ATRperiod);
if (close > BBUpper) Then
BBSignal = 1;
else if (close < BBLower) Then
BBSignal = -1;
if (BBSignal == 1) Then
{
if (UseATRfilter) Then
FollowLine = low - atrValue;
else
FollowLine = low;
if FollowLine < IFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
FollowLine = IFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]);
}
// Sell signal logic
if (BBSignal == -1) Then
{
if (UseATRfilter) Then
FollowLine = high + atrValue;
else
FollowLine = high;
if FollowLine > iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
FollowLine = iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]);
}
// Trend direction determination
if iFF(IsNan(FollowLine) == true,0,FollowLine) > iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
iTrend = 1;
else if iFF(IsNan(FollowLine) == true,0,FollowLine) < iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
iTrend = -1;
// Trend line color based on trend direction
lineColor = iff(iTrend > 0 , rgb(9, 98, 232) , rgb(220, 20, 60));
plot1(FollowLine, "Follow Line",lineColor);
var : tx(0);
if iTrend[1]==-1 and iTrend==1 Then
{
tx = Text_New(sDate,sTime,FollowLine,"Buy");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Red);
}
if iTrend[1]==1 and iTrend==-1 Then
{
tx = Text_New(sDate,sTime,FollowLine,"Sell");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Blue);
}
2. 종목검색
input : ATRperiod(5);
input : BBperiod(21);
input : BBdeviation(1.00);
input : UseATRfilter(1); // false = 0, true = 1
var : FollowLine(0),BBSignal(0);
var : BBUpper(0),BBLower(0),atrValue(0),iTrend(0),lineColor(0);
BBUpper = ma(close, BBperiod) + std(close, BBperiod) * BBdeviation;
BBLower = ma(close, BBperiod) - std(close, BBperiod) * BBdeviation;
atrValue = atr(ATRperiod);
if (close > BBUpper) Then
BBSignal = 1;
else if (close < BBLower) Then
BBSignal = -1;
if (BBSignal == 1) Then
{
if (UseATRfilter) Then
FollowLine = low - atrValue;
else
FollowLine = low;
if FollowLine < IFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
FollowLine = IFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]);
}
// Sell signal logic
if (BBSignal == -1) Then
{
if (UseATRfilter) Then
FollowLine = high + atrValue;
else
FollowLine = high;
if FollowLine > iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
FollowLine = iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]);
}
// Trend direction determination
if iFF(IsNan(FollowLine) == true,0,FollowLine) > iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
iTrend = 1;
else if iFF(IsNan(FollowLine) == true,0,FollowLine) < iFF(IsNan(FollowLine[1]) == true,0,FollowLine[1]) Then
iTrend = -1;
// Trend line color based on trend direction
lineColor = iff(iTrend > 0 , rgb(9, 98, 232) , rgb(220, 20, 60));
if iTrend[1]==-1 and iTrend==1 Then
{
Find(1);
}
즐거운 하루되세요
> 무서운라냐 님이 쓴 글입니다.
> 제목 : 예스지표 변환 요청 드립니다.
>
수고 많으십니다.
트레이딩뷰 지표입니다.
예스지표로 변환 및 Buy 신호시 검색 되도록 검색식 부탁 드립니다.
수고하세요.
//@version=5
indicator(shorttitle='FL', title='Follow Line', overlay=true)
// --- settings
ATRperiod = input.int(defval=5, title='ATR Period', minval=1)
BBperiod = input.int(defval=21, title='Bollinger Bands Period', minval=1)
BBdeviation = input.float(defval=1.00, title='Bollinger Bands Deviation', minval=0.1, step=0.1)
UseATRfilter = input(defval=true, title='ATR Filter On/Off') // false = 0, true = 1
showsignals = input(title='Show Signals ', defval=true)
// --- end of settings
// Bollinger Bands calculation
BBUpper = ta.sma(close, BBperiod) + ta.stdev(close, BBperiod) * BBdeviation
BBLower = ta.sma(close, BBperiod) - ta.stdev(close, BBperiod) * BBdeviation
// ATR calculation
atrValue = ta.atr(ATRperiod)
// Signal initialization
var float FollowLine = na
var int BBSignal = 0
// Determine BB signal
if (close > BBUpper)
BBSignal := 1
else if (close < BBLower)
BBSignal := -1
// Buy signal logic
if (BBSignal == 1)
if (UseATRfilter)
FollowLine := low - atrValue
else
FollowLine := low
if (FollowLine < nz(FollowLine[1]))
FollowLine := nz(FollowLine[1])
// Sell signal logic
if (BBSignal == -1)
if (UseATRfilter)
FollowLine := high + atrValue
else
FollowLine := high
if (FollowLine > nz(FollowLine[1]))
FollowLine := nz(FollowLine[1])
// Trend direction determination
var int iTrend = 0
if (nz(FollowLine) > nz(FollowLine[1]))
iTrend := 1
else if (nz(FollowLine) < nz(FollowLine[1]))
iTrend := -1
// Trend line color based on trend direction
lineColor = iTrend > 0 ? color.rgb(9, 98, 232) : color.new(color.rgb(220, 20, 60), 0)
//buy & sell conditions
buy=0.0
sell=0.0
buy:=iTrend[1]==-1 and iTrend==1 ? 1 : na
sell:=iTrend[1]==1 and iTrend==-1? 1 : na
//alerts
alertcondition(sell == 1 ,title="Sell",message="Follow Line Sell")
alertcondition(buy == 1 ,title="Buy",message="Follow Line Buy")
alertcondition(buy == 1 or sell == 1 ,title="Signal",message="Follow Line Signal")
// Plot the trend line and signals
plot(FollowLine, color=lineColor, linewidth=2, title="Follow Line")
plotshape(buy == 1 and showsignals ? FollowLine-atrValue :na, text='BUY', style= shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, offset=0, transp=0,size=size.auto)
plotshape(sell == 1 and showsignals ? FollowLine+atrValue:na, text='SELL', style=shape.labeldown, location=location.absolute, color=color.rgb(102, 15, 15), textcolor=color.white, offset=0, transp=0,size=size.auto)