Diagnostics
T420
trade fields are read-only
T420
The trade value in a trade handler is read-only. Read its fields directly; do not store or return it to change later.
Failing example
script "conf"
data t = subscribe(data.trades)
plot px = plot.line(title: "px")
fn f(x: Trade) -> float { return x.price }
on t.trade(tr) {
let x = tr
px.plot(f(tr))
}Corrected example
script "fixed"
data tape = subscribe(data.trades)
on tape.trade(trade) { let price = trade.price }