Skip to content
ChartDeck ChartScript docs Account Open the terminal

CS4113

error Values cannot be shared inside a request expression.

#What it means

The expression of a request runs on the requested bars. Shared values belong to the script's own bars on the chart, so share.* cannot run inside a request, also not through a function called from one.

#Typical cause

  • A share.* call inside a function that a request.tf or request.market expression calls.

#How to fix it

Bring the value back from the request and share it at the top level. See Linking scripts.

#Example

ChartScriptError: CS4113
//@chartscript 1
indicator("Daily close")
function dayClose() {
    share.event("day_close", { price: close })
    return close
}
plot(request.tf("1D", dayClose()), "Daily close")

Fixed

ChartScriptOpen in editor
//@chartscript 1
indicator("Daily close")
const d = request.tf("1D", close)
share.series("day_close", d, { title: "Last daily close" })
plot(d, "Daily close")
  • CS4106 — A linked script cannot be read inside a request expression.
  • CS3120 — Plots, inputs, drawings and alerts cannot be used inside a request expression.
  • CS4112 — share.series("id") detail.

The ChartScript documentation is in English for now; translations will follow.