Interface SignalCloseContract

Signal close sync event.

Emitted when an active pending signal is closed for any reason: take profit hit, stop loss hit, time expired, or user-initiated close.

Consumers use this event to synchronize external order management systems (e.g., cancel remaining OCO orders, record final PNL in external DB).

Consumers:

  • External order sync services
  • Audit/logging pipelines
interface SignalCloseContract {
    action: "signal-close";
    backtest: boolean;
    closeReason: StrategyCloseReason;
    currentPrice: number;
    exchangeName: string;
    frameName: string;
    originalPriceOpen: number;
    originalPriceStopLoss: number;
    originalPriceTakeProfit: number;
    pendingAt: number;
    pnl: IStrategyPnL;
    position: "long" | "short";
    priceOpen: number;
    priceStopLoss: number;
    priceTakeProfit: number;
    scheduledAt: number;
    signal: IPublicSignalRow;
    signalId: string;
    strategyName: string;
    symbol: string;
    timestamp: number;
    totalEntries: number;
    totalPartials: number;
}

Hierarchy

  • SignalSyncBase
    • SignalCloseContract

Properties

action: "signal-close"

Discriminator for signal-close action

backtest: boolean

Whether this event is from backtest mode (true) or live mode (false)

closeReason: StrategyCloseReason

Why the signal was closed

currentPrice: number

Market price at the moment of close

exchangeName: string

Exchange name where signal was executed

frameName: string

Timeframe name (used in backtest mode, empty string in live mode)

originalPriceOpen: number

Original entry price before any DCA averaging (initial priceOpen)

originalPriceStopLoss: number

Original stop loss price before any trailing adjustments

originalPriceTakeProfit: number

Original take profit price before any trailing adjustments

pendingAt: number

Position activation timestamp in milliseconds

Total PNL of the closed position (including all entries and partials)

position: "long" | "short"

Trade direction: "long" (buy) or "short" (sell)

priceOpen: number

Effective entry price at time of close (may differ from priceOpen after DCA averaging)

priceStopLoss: number

Effective stop loss price at close (may differ from original after trailing)

priceTakeProfit: number

Effective take profit price at close (may differ from original after trailing)

scheduledAt: number

Signal creation timestamp in milliseconds

Complete public signal row at the moment of this event

signalId: string

Unique signal identifier (UUID v4)

strategyName: string

Strategy name that generated this signal

symbol: string

Trading pair symbol (e.g., "BTCUSDT")

timestamp: number

Timestamp from execution context (tick's when or backtest candle timestamp)

totalEntries: number

Total number of DCA entries at the time of close (_entry.length). 1 = no averaging done (only initial entry). 2+ = averaged positions.

totalPartials: number

Total number of partial closes executed at the time of close (_partial.length). 0 = no partial closes done. 1+ = partial closes executed.