Appearance
Output
Kind: module
Namespace: output
Outputs values without visualization. For most use cases, use spline which provides styling and chart integration. For per-bar background fill, use bgColor.
Each output maintains one value per bar. A new value is added when a new bar starts and replaced when the current bar updates.
output()
Kind: func
Outputs a named value.
Syntax
output(name, value) → voidArguments
| Name | Type | Description |
|---|---|---|
| name | string | Unique identifier for the output |
| value | number, series | Value to output for the current bar |
Returns
void
Caveats
- Must be called inside
onTick(), not in theinitsection - Must be at the top level of
onTick(), not inside conditionals or loops. This ensures the call count and order remain constant across ticks
Pitfall
javascript
function onTick() {
if (bar.isConfirmed()) {
output("close", close); // ❌ inside conditional
}
}Example
javascript
function onTick() {
const sma = ta.sma(close, 20);
const ema = ta.ema(close, 20);
output("sma", sma);
output("ema", ema);
output("diff", sma - ema);
output("close", close);
}