예스스탁
예스스탁 답변
2025-04-21 14:07:12
안녕하세요
예스스탁입니다.
//input ------
input : src(close);
input : len1(3);
input : len2(5);
input : len3(7);
input : len4(9);
input : len5(10);
input : len6(12);
input : len7(17);
input : len8(20);
input : len9(23);
input : len10(26);
input : len11(29);
input : len12(32);
input : trend_color(false);
var : s1(0),s2(0),s3(0),s4(0),s5(0),s6(0);
var : l1(0),l2(0),l3(0),l4(0),l5(0),l6(0);
var : trend_up_s(False),trend_up_l(False);
var : trend_down_s(False),trend_down_l(False);
var : color_s(0),color_l(0);
//ema -----
s1 = ema(src, len1);
s2 = ema(src, len2);
s3 = ema(src, len3);
s4 = ema(src, len4);
s5 = ema(src, len5);
s6 = ema(src, len6);
l1 = ema(src, len7);
l2 = ema(src, len8);
l3 = ema(src, len9);
l4 = ema(src, len10);
l5 = ema(src, len11);
l6 = ema(src, len12);
//trend
trend_up_s = s1 > s2 and s2 > s3 and s3 > s4 and s4 > s5 and s5 > s6;
trend_up_l = l1 > l2 and l2 > l3 and l3 > l4 and l4 > l5 and l5 > l6;
trend_down_s = s1 < s2 and s2 < s3 and s3 < s4 and s4 < s5 and s5 < s6;
trend_down_l = l1 < l2 and l2 < l3 and l3 < l4 and l4 < l5 and l5 < l6;
color_s = iff(trend_color and trend_up_s ,Green , iff(trend_color and trend_down_s , red , iff(trend_color , gray , Green)));
color_l = iff(trend_color and trend_up_l ,Green , iff(trend_color and trend_down_l , red , iff(trend_color , gray , red)));
//plot -----
plot1(l1,"long 1",color_l,def,2);
plot2(l2,"long 2",color_l);
plot3(l3,"long 3",color_l);
plot4(l4,"long 4",color_l);
plot5(l5,"long 5",color_l);
plot6(l6,"long 6",color_l,Def,2);
plot7(s1,"short 1",color_s,2);
plot8(s2,"short 2",color_s);
plot9(s3,"short 3",color_s);
plot10(s4,"short 4",color_s);
plot11(s5,"short 5",color_s);
plot12(s6,"short 6",color_s,2);
즐거운 하루되세요
> 사냥꾼 님이 쓴 글입니다.
> 제목 : 변환 부탁 합니다.
> 안녕하세요.트레이딩뷰 지표인데 죄송합니다.
//input ------
src = input(close, title="source")
len1 = input(3, title="short 1")
len2 = input(5, title="short 2")
len3 = input(7, title="short 3")
len4 = input(9, title="short 4")
len5 = input(10, title="short 5")
len6 = input(12, title="short 6")
len7 = input(17, title="long 1")
len8 = input(20, title="long 2")
len9 = input(23, title="long 3")
len10 = input(26, title="long 4")
len11 = input(29, title="long 5")
len12 = input(32, title="long 6")
trend_color = input(false, title="trend color")
//ema -----
s1 = ema(src, len1)
s2 = ema(src, len2)
s3 = ema(src, len3)
s4 = ema(src, len4)
s5 = ema(src, len5)
s6 = ema(src, len6)
l1 = ema(src, len7)
l2 = ema(src, len8)
l3 = ema(src, len9)
l4 = ema(src, len10)
l5 = ema(src, len11)
l6 = ema(src, len12)
//trend
trend_up_s = s1 > s2 and s2 > s3 and s3 > s4 and s4 > s5 and s5 > s6
trend_up_l = l1 > l2 and l2 > l3 and l3 > l4 and l4 > l5 and l5 > l6
trend_down_s = s1 < s2 and s2 < s3 and s3 < s4 and s4 < s5 and s5 < s6
trend_down_l = l1 < l2 and l2 < l3 and l3 < l4 and l4 < l5 and l5 < l6
color_s = trend_color and trend_up_s ? #32cd32 : trend_color and trend_down_s ? red : trend_color ? gray : #32cd32
color_l = trend_color and trend_up_l ? #32cd32 : trend_color and trend_down_l ? red : trend_color ? gray : red
//plot -----
p_l1 = plot(l1, color=color_l, title="long 1", linewidth=2)
p_l2 = plot(l2, color=color_l, title="long 2")
p_l3 = plot(l3, color=color_l, title="long 3")
p_l4 = plot(l4, color=color_l, title="long 4")
p_l5 = plot(l5, color=color_l, title="long 5")
p_l6 = plot(l6, color=color_l, title="long 6", linewidth=2)
p_s1 = plot(s1, color=color_s, title="short 1", linewidth=2)
p_s2 = plot(s2, color=color_s, title="short 2")
p_s3 = plot(s3, color=color_s, title="short 3")
p_s4 = plot(s4, color=color_s, title="short 4")
p_s5 = plot(s5, color=color_s, title="short 5")
p_s6 = plot(s6, color=color_s, title="short 6", linewidth=2)
//fill -----
fill(p_l1, p_l6, color_l, 80, "fill long 1-6")
fill(p_s1, p_s6, color_s, 80, "fill short 1-6")
감사합니다.