events reference
Handler events that run script code when data arrives.
Code runs in on handlers: on chart.open, on chart.update, on chart.close, and on trades.trade for trade subscriptions. History is replayed through the same handlers before live data, so a script behaves the same on past and present bars.
Events
close
closeRuns once when a bar closes and becomes confirmed.
The bar values are final and the bar is now available in history.
open
openRuns once when a new bar opens.
Runs before any updates for the new bar. The previous bar is already confirmed and available in history.
trade
tradeRuns once for each trade delivered by the subscription.
The handler argument contains the trade’s price, size, side, and time.
update
updateRuns on each update while the current bar is forming.
Runs after the bar opens and before it closes. The forming values include the latest update.