CS3123
warning name belongs to the code around this request; the request expression runs on other bars and reads it as na. Pass a market / timeframe instead, or compute the value inside the request.
#What it means
This is a warning. A request expression runs on other bars than the code around it. A parameter or a local variable of the surrounding function or block does not exist there, so the request reads it as na.
#Typical cause
- A function parameter (or a variable declared in the same
ifblock or function) used inside a request expression.
#How to fix it
Compute the value inside the request, or pass the request a market or timeframe instead of a value. Constants and inputs are fine.
#Example
//@chartscript 1
indicator("Scaled daily close")
const dailyScaled = (k: float) => request.tf("1D", close * k)
plot(dailyScaled(2.0))Fixed
//@chartscript 1
indicator("Scaled daily close")
const dailyScaled = (k: float) => request.tf("1D", close) * k
plot(dailyScaled(2.0))#Related
- CS3122 — name changes on the chart bars (how), so a request cannot recompute it on the requested bars: there it is na (kw) or the chart’s current value. Compute it in a function called inside the request.