Optional lifecycle callbacks for signal events. Called when signals are opened, active, idle, closed, scheduled, or cancelled.
onTick: (symbol: string, result: IStrategyTickResult, backtest: boolean) => void | Promise<void>
Called on every tick with the result
onOpen: (symbol: string, data: IPublicSignalRow, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when new signal is opened (after validation)
onActive: (symbol: string, data: IPublicSignalRow, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when signal is being monitored (active state)
onIdle: (symbol: string, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when no active signal exists (idle state)
onClose: (symbol: string, data: IPublicSignalRow, priceClose: number, backtest: boolean) => void | Promise<void>
Called when signal is closed with final price
onSchedule: (symbol: string, data: IPublicSignalRow, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when scheduled signal is created (delayed entry)
onCancel: (symbol: string, data: IPublicSignalRow, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when scheduled signal is cancelled without opening position
onWrite: (symbol: string, data: IPublicSignalRow, backtest: boolean) => void
Called when signal is written to persist storage (for testing)
onPartialProfit: (symbol: string, data: IPublicSignalRow, currentPrice: number, revenuePercent: number, backtest: boolean) => void | Promise<void>
Called when signal is in partial profit state (price moved favorably but not reached TP yet)
onPartialLoss: (symbol: string, data: IPublicSignalRow, currentPrice: number, lossPercent: number, backtest: boolean) => void | Promise<void>
Called when signal is in partial loss state (price moved against position but not hit SL yet)
onBreakeven: (symbol: string, data: IPublicSignalRow, currentPrice: number, backtest: boolean) => void | Promise<void>
Called when signal reaches breakeven (stop-loss moved to entry price to protect capital)
onPing: (symbol: string, data: IPublicSignalRow, when: Date, backtest: boolean) => void | Promise<void>
Called every minute regardless of strategy interval (for custom monitoring like checking if signal should be cancelled)