0

This indicator, when used on the M15 timeframe, only plots the boxes back to 4th April. Why is this? If I removed the second box, it plots as far back as Feb 26th.

I know TV indicators can only plot a limited number of graphics, but is it more limited for certain types of plot?

//@version=6
indicator("London Session Highlight", overlay=true)
// Note: Be sure to select "Pinned to right scale"
// === Background during London session (08:00–17:00 UTC+2) ===
startHour = 8
startMin = 0
endHour = 16
endMin = 15
sessionStart = timestamp('UTC', year, month, dayofmonth, startHour, startMin)
sessionEnd = timestamp('UTC', year, month, dayofmonth, endHour, endMin)
isInSession = sessionStart <= time and time <= sessionEnd
bgcolor(isInSession ? color.new(color.blue, 80) : na)
// === 9am M15 candle ===
var white = color.new(color.white, 80)
var yellow = color.new(color.yellow, 80)
isNineAM = (hour(time, 'UTC') == startHour) and (minute == 0)
isNineFifteenAM = (hour(time, 'UTC') == startHour) and (minute == 15)
bgcolor(isNineAM ? color.new(color.orange, 80) : na)
if isNineFifteenAM and not na(high[1]) and not na(low[1]) and high[1] != low[1] and barstate.isconfirmed
 startIndex = bar_index-1
 endIndex = bar_index + 32
 box.new(left=startIndex, right=endIndex, top=high[1]+(high[1]-low[1]), bottom=low[1]-(high[1]-low[1]), border_color=na, bgcolor=yellow)
 box.new(left=startIndex, right=endIndex, top=high[1], bottom=low[1], border_color=na, bgcolor=white)

enter image description here

asked May 6, 2025 at 12:25

1 Answer 1

2

Pine Script limits the number of boxes for server resources (similarly restricting lines, labels, and polylines).

By default, it displays the last 50 boxes. You can explicitly increase this limit to 500 by passing the max_boxes_count parameter on your indicator declaration statement:

indicator("London Session Highlight", overlay=true, max_boxes_count=500)
answered May 6, 2025 at 13:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.