ISignalRow

Complete signal with auto-generated id. Used throughout the system after validation.

id: string

Unique signal identifier (UUID v4 auto-generated)

cost: number

Cost of this entry in USD (e.g. 100 for $100 position)

priceOpen: number

Entry price for the position

exchangeName: string

Unique exchange identifier for execution

strategyName: string

Unique strategy identifier for execution

frameName: string

Unique frame identifier for execution (empty string for live mode)

scheduledAt: number

Signal creation timestamp in milliseconds (when signal was first created/scheduled)

pendingAt: number

Pending timestamp in milliseconds (when position became pending/active at priceOpen)

symbol: string

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

_isScheduled: boolean

Internal runtime marker for scheduled signals

_partial: { type: "profit" | "loss"; percent: number; currentPrice: number; costBasisAtClose: number; entryCountAtClose: number; timestamp: number; }[]

History of partial closes for PNL calculation. Each entry contains type (profit/loss), percent closed, and price. Used to calculate weighted PNL: Σ(percent_i × pnl_i) for each partial + (remaining% × final_pnl)

Computed values (derived from this array):

  • _tpClosed: Sum of all "profit" type partial close percentages
  • _slClosed: Sum of all "loss" type partial close percentages
  • _totalClosed: Sum of all partial close percentages (profit + loss)
_trailingPriceStopLoss: number

Trailing stop-loss price that overrides priceStopLoss when set. Updated by trailing() method based on position type and percentage distance.

  • For LONG: moves upward as price moves toward TP (never moves down)
  • For SHORT: moves downward as price moves toward TP (never moves up) When _trailingPriceStopLoss is set, it replaces priceStopLoss for TP/SL checks. Original priceStopLoss is preserved in persistence but ignored during execution.
_entry: { price: number; cost: number; timestamp: number; }[]

DCA (Dollar Cost Averaging) entry history. First element is always the original priceOpen at signal creation. Each subsequent element is a new averaging entry added by averageBuy(). Effective entry price = simple arithmetic mean of all price values. Original priceOpen is preserved unchanged for identity/audit purposes.

_trailingPriceTakeProfit: number

Trailing take-profit price that overrides priceTakeProfit when set. Created and managed by trailingTake() method for dynamic TP adjustment. Allows moving TP further from or closer to current price based on strategy. Updated by trailingTake() method based on position type and percentage distance.

  • For LONG: can move upward (further) or downward (closer) from entry
  • For SHORT: can move downward (further) or upward (closer) from entry When _trailingPriceTakeProfit is set, it replaces priceTakeProfit for TP/SL checks. Original priceTakeProfit is preserved in persistence but ignored during execution.
_peak: { price: number; timestamp: number; pnlPercentage: number; pnlCost: number; }

Best price seen in profit direction during the life of this position. Initialized at position open with priceOpen/pendingAt. Updated on every tick/candle when price moves toward TP (currentDistance > 0).

  • For LONG: maximum VWAP price seen above effective entry
  • For SHORT: minimum VWAP price seen below effective entry
timestamp: number

Unix timestamp in milliseconds when this signal was created/scheduled in backtest context or when getSignal was called in live context (before validation)