예스스탁
예스스탁 답변
2025-04-14 14:28:03
안녕하세요
예스스탁입니다.
input : bull_col(Green);
input : bear_col(red);
input : mid_col(Gray);
var : line_1(nan),line_2(Nan);
var : count(0),hh(0),ll(0),mid(0),color_trend(0),trend(False);
if Bdate == Bdate[1] Then
{
count = count+1;
hh = highest(H,count);
ll = lowest(L,count);
}
if Bdate != Bdate[1] Then
{
count = 0;
var1 = hh[1];
line_1 = TL_New(sDate,sTime,var1,NextBarSdate,NextBarStime,var1);
TL_SetColor(line_1,bear_col);
TL_SetStyle(line_1,3);
var2 = ll[1];
line_2 = TL_New(sDate,sTime,var2,NextBarSdate,NextBarStime,var2);
TL_SetColor(line_2,bull_col);
TL_SetStyle(line_2,3);
}
TL_SetEnd(line_1,sDate,sTime,var1);
TL_SetEnd(line_2,sDate,sTime,var2);
mid = avg(var1,var2);
if CrossUp(close,var1) Then
{
color_trend = bull_col;
trend = true;
}
if CrossDown(close, var2) Then
{
color_trend = bear_col;
trend = false;
}
plot1(mid, "Trend",color_trend,Def,2);
즐거운 하루되세요
> 레전드 님이 쓴 글입니다.
> 제목 : 문의
> indicator("HTF Trend Tracker [BigBeluga]", overlay = true, max_lines_count = 500, max_labels_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
tf = input.timeframe("D", "Timeframe")
bull_col = input.color(color.rgb(12, 193, 142), "✓", inline = "col")
bear_col = input.color(color.red, "✕", inline = "col")
mid_col = input.color(color.rgb(121, 121, 121), "-", inline = "col")
var line_1 = line(na)
var line_2 = line(na)
var color_trend = color(na)
var trend = bool(na)
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
draw_line(x1, x2, y, txt, color)=>
l = line.new(x1, y, x2, y, color = color, style = line.style_dashed)
label.delete(label.new(x1, y, txt, color = color(na), style = label.style_label_right)[1])
l
var h = float(na)
var l = float(na)
var count = 0
if not timeframe.change(tf)
count +=1
h := ta.highest(count)
l := ta.lowest(count)
if timeframe.change(tf)
count := 0
line_1 := draw_line(bar_index, bar_index, h[1], tf + " High", bear_col)
line_2 := draw_line(bar_index, bar_index, l[1], tf + " Low", bull_col)
line_1.set_x2(bar_index)
line_2.set_x2(bar_index)
if barstate.islast
line.delete(line.new(line_1.get_x1(), line_1.get_y1(), bar_index+15, line_1.get_y1(), color = bear_col, style = line.style_arrow_right)[1])
line.delete(line.new(line_2.get_x1(), line_2.get_y1(), bar_index+15, line_2.get_y1(), color = bull_col, style = line.style_arrow_right)[1])
mid = math.avg(line_1.get_y1(),line_2.get_y1())
if ta.crossover(close, line_1.get_y1()) and barstate.isconfirmed
color_trend := bull_col
trend := true
if ta.crossunder(close, line_2.get_y1()) and barstate.isconfirmed
color_trend := bear_col
trend := false
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if trend and trend != trend[1]
label.new(bar_index, low - ta.sma(high-low, 100), "✓", style = label.style_label_up, size = size.tiny, color = bull_col)
if not trend and trend != trend[1]
label.new(bar_index, high + ta.sma(high-low, 100), "✕", style = label.style_label_down, size = size.tiny, color = bear_col)
high_sdv = (high- mid)
low_sdv = (mid - low)
color_bars =
trend
? color.from_gradient(high_sdv, 0, ta.highest(high_sdv, 100), mid_col, bull_col)
: color.from_gradient(low_sdv, 0, ta.highest(low_sdv,100), mid_col, bear_col)
plotcandle(open, high, low, close, title ='Candles', color = color_bars, wickcolor=color_bars, bordercolor = color_bars)
plot(mid, "Trend", color = color_trend, linewidth = 2)
// }
예스식으로 부탁드립니다