예스스탁
예스스탁 답변
2025-09-11 11:14:33.0
안녕하세요
예스스탁입니다.
input : length(70);
input : mult(1.2);
var : a(0),lag(0);
var : zlema(0,Data1),atrv(0,Data1),volatility(0,Data1),trend(0,Data1),zlemaColor(0,Data1),tx(0,Data1);
a = 1 / length ;
lag = floor((length - 1) / 2);
zlema = data1(ema(close + (close - close[lag]), length));
ATRV = data1(IFf(IsNan(ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(ATRV[1])==true,0,ATRV[1])));
volatility = data1(highest(ATRV, length*3) * mult);
if data1(CrossUp(close, zlema+volatility)) Then
trend = 1;
if data1(CrossDown(close, zlema-volatility)) Then
trend = -1;
zlemaColor = data1(iff(trend == 1 , green , red));
plot1(zlema, "Zero Lag Basis",zlemaColor);
if trend == 1 Then
plot2(zlema+volatility,"upper",red);
Else
NoPlot(2);
if trend == -1 Then
plot3(zlema-volatility,"lower",Green);
Else
NoPlot(3);
if data1(CrossUp(close,zlema) and trend == 1 and trend[1] == 1) Then
{
tx = Text_New(sDate,sTime, zlema-volatility*1.5,"▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,Green);
}
if data1(CrossDown(close,zlema) and trend == -1 and trend[1] == -1) Then
{
tx = Text_New(sDate,sTime, zlema+volatility*1.5,"▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Red);
}
var : d2zlema(0,Data2),d2atrv(0,Data2),d2volatility(0,Data2),d2trend(0,Data2);
d2zlema = data2(ema(close + (close - close[lag]), length));
d2ATRV = data2(IFf(IsNan(d2ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(d2ATRV[1])==true,0,d2ATRV[1])));
d2volatility = data2(highest(d2ATRV, length*3) * mult);
if data2(CrossUp(close, d2zlema+d2volatility)) Then
d2trend = 1;
if data2(CrossDown(close, d2zlema-d2volatility)) Then
d2trend = -1;
var : d3zlema(0,data3),d3atrv(0,data3),d3volatility(0,data3),d3trend(0,data3);
d3zlema = data3(ema(close + (close - close[lag]), length));
d3ATRV = data3(IFf(IsNan(d3ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(d3ATRV[1])==true,0,d3ATRV[1])));
d3volatility = data3(highest(d3ATRV, length*3) * mult);
if data3(CrossUp(close, d3zlema+d3volatility)) Then
d3trend = 1;
if data3(CrossDown(close, d3zlema-d3volatility)) Then
d3trend = -1;
var : d4zlema(0,data4),d4atrv(0,data4),d4volatility(0,data4),d4trend(0,data4);
d4zlema = data4(ema(close + (close - close[lag]), length));
d4ATRV = data4(IFf(IsNan(d4ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(d4ATRV[1])==true,0,d4ATRV[1])));
d4volatility = data4(highest(d4ATRV, length*3) * mult);
if data4(CrossUp(close, d4zlema+d4volatility)) Then
d4trend = 1;
if data4(CrossDown(close, d4zlema-d4volatility)) Then
d4trend = -1;
var : d5zlema(0,data5),d5atrv(0,data5),d5volatility(0,data5),d5trend(0,data5);
d5zlema = data5(ema(close + (close - close[lag]), length));
d5ATRV = data5(IFf(IsNan(d5ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(d5ATRV[1])==true,0,d5ATRV[1])));
d5volatility = data5(highest(d5ATRV, length*3) * mult);
if data5(CrossUp(close, d5zlema+d5volatility)) Then
d5trend = 1;
if data5(CrossDown(close, d5zlema-d5volatility)) Then
d5trend = -1;
var : d6zlema(0,data6),d6atrv(0,data6),d6volatility(0,data6),d6trend(0,data6);
d6zlema = data6(ema(close + (close - close[lag]), length));
d6ATRV = data6(IFf(IsNan(d6ATRV[1]) == true, ma(TrueRange,length) , a * TrueRange + (1 - a) * IFf(isnan(d6ATRV[1])==true,0,d6ATRV[1])));
d6volatility = data6(highest(d6ATRV, length*3) * mult);
if data6(CrossUp(close, d6zlema+d6volatility)) Then
d6trend = 1;
if data6(CrossDown(close, d6zlema-d6volatility)) Then
d6trend = -1;
var : s2a(""),s3a(""),s4a(""),s5a(""),s6a("");
if d2trend == 1 Then
s2a = "Bullish";
Else
s2a = "Bearish";
if d3trend == 1 Then
s3a = "Bullish";
Else
s3a = "Bearish";
if d4trend == 1 Then
s4a = "Bullish";
Else
s4a = "Bearish";
if d5trend == 1 Then
s5a = "Bullish";
Else
s5a = "Bearish";
if d6trend == 1 Then
s6a = "Bullish";
Else
s6a = "Bearish";
var : Grid(0);
if Index == 0 Then
{
Grid = Grid_New(1, 2, 6,White, Gray, 1, Gray, 0);
}
if LastBarOnChart == 1 Then
{
Grid_Cell(Grid,0,0,"데이터",0,0,White,Black);
Grid_Cell(Grid,1,0,"Signal",0,0,White,Black);
Grid_Cell(Grid,0,1,"Data2",0,0,BLACK,gray);
Grid_Cell(Grid,1,1,s2a,0,0,BLACK,iff(d2trend==1,green,LightRed));
Grid_Cell(Grid,0,2,"Data3",0,0,BLACK,gray);
Grid_Cell(Grid,1,2,s2a,0,0,BLACK,iff(d3trend==1,green,LightRed));
Grid_Cell(Grid,0,3,"Data4",0,0,BLACK,gray);
Grid_Cell(Grid,1,3,s2a,0,0,BLACK,iff(d4trend==1,green,LightRed));
Grid_Cell(Grid,0,4,"Data5",0,0,BLACK,gray);
Grid_Cell(Grid,1,4,s2a,0,0,BLACK,iff(d5trend==1,green,LightRed));
Grid_Cell(Grid,0,5,"Data6",0,0,BLACK,gray);
Grid_Cell(Grid,1,5,s2a,0,0,BLACK,iff(d6trend==1,green,LightRed));
}
즐거운 하루되세요
> 씸풀 님이 쓴 글입니다.
> 제목 : 변환 부탁드립니다
> 수고하십니다. 다음 트레이딩뷰 지표를 예스트레이더 용으로 변환시켜 주시면 감사하겠습니다.
plot은 현 시간대(Data1)에 대해 구현하고, 내용 중 5가지의 다른 시간대에 대한 테이블을 만드는 것이 있는데, 차트에 종목 추가로 넣어서 이를 구현하도록 해 주십시오. alert부분은 생략해도 됩니다. 감사합니다.
시간대: Data1=5분봉, Data2=15분봉, Data3=60분봉, Data4=240분봉, Data5=일봉
(봉수 제한으로 일봉을 넣기가 힘들면 일봉 제외하고 Data4까지만 사용)
(트레이딩뷰 지표)
//@version=5
indicator("Zero Lag Trend Signals (MTF) [AlgoAlpha]", shorttitle="AlgoAlpha - 0??Zero Lag Signals", overlay=true)
length = input.int(70, "Length", tooltip = "The Look-Back window for the Zero-Lag EMA calculations", group = "Main Calculations")
mult = input.float(1.2, "Band Multiplier", tooltip = "This value controls the thickness of the bands, a larger value makes the indicato less noisy", group = "Main Calculations")
t1 = input.timeframe("5", "Time frame 1", group = "Extra Timeframes")
t2 = input.timeframe("15", "Time frame 2", group = "Extra Timeframes")
t3 = input.timeframe("60", "Time frame 3", group = "Extra Timeframes")
t4 = input.timeframe("240", "Time frame 4", group = "Extra Timeframes")
t5 = input.timeframe("1D", "Time frame 5", group = "Extra Timeframes")
green = input.color(#00ffbb, "Bullish Color", group = "Appearance")
red = input.color(#ff1100, "Bearish Color", group = "Appearance")
src = close
lag = math.floor((length - 1) / 2)
zlema = ta.ema(src + (src - src[lag]), length)
volatility = ta.highest(ta.atr(length), length*3) * mult
var trend = 0
if ta.crossover(close, zlema+volatility)
trend := 1
if ta.crossunder(close, zlema-volatility)
trend := -1
zlemaColor = trend == 1 ? color.new(green, 70) : color.new(red, 70)
m = plot(zlema, title="Zero Lag Basis", linewidth=2, color=zlemaColor)
upper = plot(trend == -1 ? zlema+volatility : na, style = plot.style_linebr, color = color.new(red, 90), title = "Upper Deviation Band")
lower = plot(trend == 1 ? zlema-volatility : na, style = plot.style_linebr, color = color.new(green, 90), title = "Lower Deviation Band")
fill(m, upper, (open + close) / 2, zlema+volatility, color.new(red, 90), color.new(red, 70))
fill(m, lower, (open + close) / 2, zlema-volatility, color.new(green, 90), color.new(green, 70))
plotshape(ta.crossunder(trend, 0) ? zlema+volatility : na, "Bearish Trend", shape.labeldown, location.absolute, red, text = "▼", textcolor = chart.fg_color, size = size.small)
plotshape(ta.crossover(trend, 0) ? zlema-volatility : na, "Bullish Trend", shape.labelup, location.absolute, green, text = "▲", textcolor = chart.fg_color, size = size.small)
plotchar(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1 ? zlema-volatility*1.5 : na, "Bullish Entry", "▲", location.absolute, green, size = size.tiny)
plotchar(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1 ? zlema+volatility*1.5 : na, "Bearish Entry", "▼", location.absolute, red, size = size.tiny)
s1 = request.security(syminfo.tickerid, t1, trend)
s2 = request.security(syminfo.tickerid, t2, trend)
s3 = request.security(syminfo.tickerid, t3, trend)
s4 = request.security(syminfo.tickerid, t4, trend)
s5 = request.security(syminfo.tickerid, t5, trend)
s1a = s1 == 1 ? "Bullish" : "Bearish"
s2a = s2 == 1 ? "Bullish" : "Bearish"
s3a = s3 == 1 ? "Bullish" : "Bearish"
s4a = s4 == 1 ? "Bullish" : "Bearish"
s5a = s5 == 1 ? "Bullish" : "Bearish"
if barstate.islast
var data_table = table.new(position=position.top_right, columns=2, rows=6, bgcolor=chart.bg_color, border_width=1, border_color=chart.fg_color, frame_color=chart.fg_color, frame_width=1)
table.cell(data_table, text_halign=text.align_center, column=0, row=0, text="Time Frame", text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=0, text="Signal", text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=0, row=1, text=t1, text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=1, text=s1a, text_color=chart.fg_color, bgcolor=s1a == "Bullish" ? color.new(green, 70) : color.new(red, 70))
table.cell(data_table, text_halign=text.align_center, column=0, row=2, text=t2, text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=2, text=s2a, text_color=chart.fg_color, bgcolor=s2a == "Bullish" ? color.new(green, 70) : color.new(red, 70))
table.cell(data_table, text_halign=text.align_center, column=0, row=3, text=t3, text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=3, text=s3a, text_color=chart.fg_color, bgcolor=s3a == "Bullish" ? color.new(green, 70) : color.new(red, 70))
table.cell(data_table, text_halign=text.align_center, column=0, row=4, text=t4, text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=4, text=s4a, text_color=chart.fg_color, bgcolor=s4a == "Bullish" ? color.new(green, 70) : color.new(red, 70))
table.cell(data_table, text_halign=text.align_center, column=0, row=5, text=t5, text_color=chart.fg_color)
table.cell(data_table, text_halign=text.align_center, column=1, row=5, text=s5a, text_color=chart.fg_color, bgcolor=s5a == "Bullish" ? color.new(green, 70) : color.new(red, 70))
/////////////////////////////////////////ALERTS FOR SMALL ARROWS (ENTRY SIGNALS)
alertcondition(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1, "Bullish Entry Signal",
message="Bullish Entry Signal detected. Consider entering a long position.")
alertcondition(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1, "Bearish Entry Signal",
message="Bearish Entry Signal detected. Consider entering a short position.")
/////////////////////////////////////////ALERTS FOR TREND CONDITIONS
alertcondition(ta.crossover(trend, 0), "Bullish Trend")
alertcondition(ta.crossunder(trend, 0), "Bearish Trend")
alertcondition(ta.cross(trend, 0), "(Bullish or Bearish) Trend")
alertcondition(ta.crossover(s1, 0), "Bullish Trend Time Frame 1")
alertcondition(ta.crossunder(s1, 0), "Bearish Trend Time Frame 1")
alertcondition(ta.cross(s1, 0), "(Bullish or Bearish) Trend Time Frame 1")
alertcondition(ta.crossover(s2, 0), "Bullish Trend Time Frame 2")
alertcondition(ta.crossunder(s2, 0), "Bearish Trend Time Frame 2")
alertcondition(ta.cross(s2, 0), "(Bullish or Bearish) Trend Time Frame 2")
alertcondition(ta.crossover(s3, 0), "Bullish Trend Time Frame 3")
alertcondition(ta.crossunder(s3, 0), "Bearish Trend Time Frame 3")
alertcondition(ta.cross(s3, 0), "(Bullish or Bearish) Trend Time Frame 3")
alertcondition(ta.crossover(s4, 0), "Bullish Trend Time Frame 4")
alertcondition(ta.crossunder(s4, 0), "Bearish Trend Time Frame 4")
alertcondition(ta.cross(s4, 0), "(Bullish or Bearish) Trend Time Frame 4")
alertcondition(ta.crossover(s5, 0), "Bullish Trend Time Frame 5")
alertcondition(ta.crossunder(s5, 0), "Bearish Trend Time Frame 5")
alertcondition(ta.cross(s5, 0), "(Bullish or Bearish) Trend Time Frame 5")
alertcondition(ta.crossover(close, zlema) and trend == 1 and trend[1] == 1, "Bullish Entry")
alertcondition(ta.crossunder(close, zlema) and trend == -1 and trend[1] == -1, "Bearish Entry")