Soinov
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: June 27th, 2023

Some bug with request.security?

Hello! Checking function request.security(). I found out that this function incorrectly collects data for minute bars from five-minute bars.

Code: Select all

//@version=5
indicator("My script", overlay = true, max_labels_count = 500)
high5min = request.security(syminfo.tickerid, "5", high)
bar5Index = request.security(syminfo.tickerid, "5", bar_index)

// Bug visualization
label.new(    bar_index, low, yloc = yloc.belowbar, 
                         text = "5 min\nbar_index\n" + str.tostring(bar5Index, "#"), 
                         textcolor = color.new(color.red, 10), 
                         color = color.new(color.black, 20), style = label.style_label_up)

label.new(  bar_index, low, yloc = yloc.abovebar, 
                         text = "5 min\nhigh\n" + str.tostring(high5min, "#.00"), 
                         textcolor = color.new(color.green, 10), 
                         color = color.new(color.black, 20), style = label.style_label_down)
Image

Return to “Pine Script Q&A”