Tells a script whether it is calculating for the chart or for an alert, as the string chart or alert.
runtime.calculation.mode is a simple string. Compare it with runtime.calculation.mode.chart and runtime.calculation.mode.alert. A script runs in chart mode when it draws on your chart, and in alert mode when the alert system runs a copy of it on the server.
Use it to change behavior between the two: skip drawings that no one sees in alert mode, or build an alert message only there.
Type
simple string
Remarks
- The value is the same for every bar of one run.
- On Sidechair: not supported yet; a script that reads
runtime.calculation.modestops with the error "runtime.calculation.mode" isn't supported yet.
Example
//@version=6
indicator("Chart-only drawing", overlay = true)
onChart = runtime.calculation.mode == runtime.calculation.mode.chart
plot(close, "Close", color.gray)
if onChart and barstate.islast
label.new(bar_index, high, "drawn on the chart")See also
Not on Sidechair yet