예스스탁
예스스탁 답변
2025-05-20 10:52:25
안녕하세요
예스스탁입니다.
input : color_up(Orange);
input : color_dn(Blue);
var : tf_trend(0),tf_col(0);
var : tx1(0),tx2(0),tx3(0),tx4(0);
if Bdate != Bdate[1] Then
{
var1 = 0;
var2 = 0;
tx3 = Text_New(sDate,sTime,DayHigh,ntostr(DayHigh,2));
tx4 = Text_New(sDate,sTime,DayLow,ntostr(DayLow,2));
Text_SetStyle(tx3,0,1);
Text_SetStyle(tx4,0,0);
}
Else
{
var1 = var1+H;
var2 = var2+1;
var1 = var1+L;
var2 = var2+1;
Text_SetString(tx3,ntostr(DayHigh,2));
Text_SetString(tx4,ntostr(DayLow,2));
Text_SetLocation(tx3,sDate,sTime,DayHigh);
Text_SetLocation(tx4,sDate,sTime,DayLow);
}
tf_trend = var1/var2;
tf_col = iff(tf_trend > tf_trend[1] , color_up , color_dn);
if tf_trend > 0 Then
Plot1(tf_trend,"tf_trend",tf_col,Def,2);
Else
NoPlot(1);
if Bdate == Bdate[1] and Index%2 == 0 Then
{
tx1 = Text_New(sDate,sTime,DayHigh,"--");
Text_SetStyle(tx1,2,2);
}
if Bdate == Bdate[1] and Index%2 == 0 Then
{
tx2 = Text_New(sDate,sTime,DayLow,"--");
Text_SetStyle(tx2,2,2);
}
즐거운 하루되세요
> 갈랑교 님이 쓴 글입니다.
> 제목 : 항상 감사합니다 지표 변환 부탁드립니다
> // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
tf = input.timeframe("D")
color_up = input.color(color.rgb(229, 148, 27), "", inline = "color")
color_dn = input.color(color.rgb(30, 142, 234), "", inline = "color")
var array_vals = array.new<float>()
var count = 0
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
convert_tf(tf)=>
time_in = timeframe.in_seconds(tf) / 60 / 60
time_in >= 24 ? tf : time_in >= 1 ? str.tostring(time_in) + "h" : tf + "m"
current_tf_min = timeframe.in_seconds("")/60
user_tf_min = timeframe.in_seconds(tf)/60
bars_amount = int(user_tf_min / current_tf_min)
tf_change = timeframe.change(tf)
if tf_change
label.new(bar_index, array_vals.max(), str.tostring(array_vals.max(), "#,###.###"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)
label.new(bar_index, array_vals.min(), str.tostring(array_vals.min(), "#,###.###"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)
array_vals.clear()
count := 0
if not tf_change
count +=1
array_vals.push(high)
array_vals.push(low)
max = array_vals.max()
min = array_vals.min()
tf_trend = array_vals.avg()
color tf_col = tf_trend > tf_trend[1] ? color_up : color_dn
color time_color = color.from_gradient(count, 0, bars_amount, color.new(tf_col, 0), color.new(tf_col, 100))
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
plotshape(tf_change[1] ? tf_trend : na, "", shape.circle, location.absolute, color.new(chart.fg_color, 30), size = size.tiny)
plot(tf_trend, "HTF Trend", color = tf_change ? color(na) : tf_col, style = plot.style_linebr, linewidth = 1)
plot(tf_trend, "HTF Trend", color = tf_change ? color(na) : time_color, style = plot.style_linebr, linewidth = 5)
plot(max != max[1] ? na : max, "High Level", color = bar_index % 2 == 0 ? chart.fg_color : color(na), style = plot.style_steplinebr)
plot(min != min[1] ? na : min, "Low Level", color = bar_index % 2 == 0 ? chart.fg_color : color(na), style = plot.style_steplinebr)
bgcolor(tf_change ? color.new(chart.fg_color, 85) : na)
if barstate.islast
l1 = label.new(bar_index, array_vals.max(), str.tostring(array_vals.max(), "#,###.###"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)
l2 = label.new(bar_index, array_vals.min(), str.tostring(array_vals.min(), "#,###.###"), style = label.style_label_left, color = color(na), textcolor = chart.fg_color)
label.delete(l1[1])
label.delete(l2[1])
dash = table.new(position.top_right, 10, 10)
dash.cell(0, 0, "Timeframe: ", text_color = chart.fg_color)
dash.cell(1,0, convert_tf(tf), text_color = chart.fg_color)
dash.cell(0, 1, "Trend: ", text_color = chart.fg_color)
dash.cell(1, 1, tf_trend > tf_trend[1] ? "🢁" : "🢃", text_color = tf_col)
// }