Skip to content

DSL Events

Events define robot lifecycle blocks.

onBar

Runs after historical candles are loaded and for bar-based execution.

onBar {
  if close > close[1] {
    signal = 1
  }
}

onTick

Runs on each live quote event.

onTick {
  if ask > 0 {
    signal = 1
  }
}

Reserved Events

The following events are reserved for lifecycle support:

  • onInit
  • onStop

Runtime Logging

Robots can write diagnostic messages to the script console:

onTick {
  log("last time", time)
}

log(...) emits a runtime log action. It is not a trade action and does not consume maxActionsPerEvent.