最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

pine script v5 - Drawing M1 box in a higher timeframe environment - Stack Overflow

programmeradmin1浏览0评论

I'm struggling with the following issue: I would like to draw a box to a certain M1-candle. Let's say the 12:53 candle.

The code below does it perfectly:

// @version=6
indicator("Test Timestamp", overlay = true)
string timeZone ="America/New_York"
int candle000test = timestamp(timeZone, year, month, dayofmonth, 12, 53) //candle 00:08
int routeEndTime = timestamp(timeZone, year, month, dayofmonth, 16, 44)


var box testing = na
if time == candle000test //and barstate.isconfirmed
    testing := box.new(left = time, top = high, right = time + (routeEndTime - candle000test), bottom = low,
     text = "19:53", text_size = size.tiny, text_color = color.black, text_halign = text.align_right, text_font_family = font.family_monospace,
     border_color = color.new(color.gray, 50), bgcolor = color.new(color.gray, 50), xloc = xloc.bar_time)

If I switch to a higher timeframe, e.g. M15, the box vanishes. Does anybody know what I can do to display the M1 box in other timeframes?

Thank you very much.

发布评论

评论列表(0)

  1. 暂无评论