I want to hold the result of ‘request.security’ in a variable once so I can refer it later, but when I’m checking the result in my sample code below I get the correct result only when the timeframe of chart is daily.
When I make it 4h or even weekly I get ‘NAN’ result. Can someone explain to me why this is happening?
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5
indicator("Test", overlay=true)
var pdd = request.security(syminfo.tickerid, 'D', high, calc_bars_count = 2)
label.new(bar_index, high, str.format("{0, number, #.########}", pdd))