Pine compatibility: what works and what doesn't
Paste-from-TradingView works for indicators that use supported builtins; a few namespaces are not there yet.
OxScript uses Pine's names with Pine's meaning. Indentation blocks, => functions, :=, tuples, switch, method and type parse unchanged, so a v5 or v6 indicator that uses supported builtins compiles without edits.
The header picks the mode
| First line | Means |
|---|---|
//@oxscript=1 | OxScript, version 1 (current). Use it for scripts you write here. |
| No header | The latest OxScript. |
//@version=5, //@version=6 | Pine compatibility mode: a script pasted from TradingView runs unchanged. |
//@version=1 to 4 | Refused. The error suggests //@oxscript=1; older Pine needs porting to v5 first. |
//@oxscript=2 or any unknown number | Refused with an error naming the current version. |
| Works | Not yet |
|---|---|
ta.*, math.*, str.*, color.*, input.* | request.security and every request.*: scripts run on the chart's own symbol and timeframe |
array.*, map.*, matrix.*, user types (type) | import of TradingView libraries |
label, line, box, table, linefill | polyline |
plot, plotshape, plotchar, hline, fill, bgcolor, barcolor | Order-flow fields (delta, footprint levels) inside scripts |
alert(), alertcondition() | — |
strategy() and strategy.* | — |
Unsupported calls fail loudly
A script that calls request.security does not compile. The error names the call, its line and column, and says why: request.security is not supported yet: scripts run on the chart's own symbol and timeframe. Nothing silently returns na.
Where OxScript is easier than Pine
- Keyword arguments on every call:
ta.alma(close, length=9, offset=0.85, sigma=6). - No
simple/seriesqualifier puzzles. The one rule enforced is that a lookback length is known before the first bar (a literal or an input). - No
max_bars_back: the history depth is worked out from the code. - Optional
{ }blocks:if close > open { n := n + 1 }.