CS3120
error Plots, inputs, drawings and alerts cannot be used inside a request expression.
#What it means
The expression of a request runs on the requested bars, not on the chart. Plots, inputs, drawings and alerts belong to the chart, so they cannot appear inside it.
#Typical cause
- An
input.*call written inside the request. - A drawing or plot created inside a function that is called inside a request.
#How to fix it
Create the input (or plot, or drawing) at the top level, and only use its value inside the request.
#Example
//@chartscript 1
indicator("Daily average", { overlay: true })
plot(request.tf("1D", ta.sma(close, input.int(20, "Length"))))Fixed
//@chartscript 1
indicator("Daily average", { overlay: true })
const len = input.int(20, "Length")
plot(request.tf("1D", ta.sma(close, len)))