OPEN-SOURCE SCRIPT
XAUUSD 4H Candle Close Vertical Lines + Labels (debug)

//version=5
indicator("XAUUSD 4H Candle Close Vertical Lines + Labels (debug)", overlay=true)
// Detect when a new 4H candle closes
new_4h_candle = ta.change(time("240"))
// Debug: show tiny shape when detection happens (remove later if not needed)
plotshape(new_4h_candle, title="4H close detected", style=shape.triangleup, location=location.belowbar, size=size.tiny)
// When a new 4H candle closes, draw a vertical dotted blue line and a label
if new_4h_candle
// vertical line at current bar_index
line.new(
x1=bar_index,
y1=na,
x2=bar_index,
y2=na,
xloc=xloc.bar_index,
extend=extend.both,
color=color.new(color.blue, 0),
style=line.style_dotted,
width=1)
// label at the low of the bar (adjust y if you want it elsewhere)
label.new(
x=bar_index,
y=low,
text="4H Close\n" + str.format("{0,time,HH:mm}", time),
xloc=xloc.bar_index,
style=label.style_label_down,
color=color.new(color.blue, 85),
textcolor=color.white,
size=size.tiny)
indicator("XAUUSD 4H Candle Close Vertical Lines + Labels (debug)", overlay=true)
// Detect when a new 4H candle closes
new_4h_candle = ta.change(time("240"))
// Debug: show tiny shape when detection happens (remove later if not needed)
plotshape(new_4h_candle, title="4H close detected", style=shape.triangleup, location=location.belowbar, size=size.tiny)
// When a new 4H candle closes, draw a vertical dotted blue line and a label
if new_4h_candle
// vertical line at current bar_index
line.new(
x1=bar_index,
y1=na,
x2=bar_index,
y2=na,
xloc=xloc.bar_index,
extend=extend.both,
color=color.new(color.blue, 0),
style=line.style_dotted,
width=1)
// label at the low of the bar (adjust y if you want it elsewhere)
label.new(
x=bar_index,
y=low,
text="4H Close\n" + str.format("{0,time,HH:mm}", time),
xloc=xloc.bar_index,
style=label.style_label_down,
color=color.new(color.blue, 85),
textcolor=color.white,
size=size.tiny)
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.