Interface IPublicSignalRow

Public signal row with original stop-loss and take-profit prices. Extends ISignalRow to include originalPriceStopLoss and originalPriceTakeProfit for external visibility. Used in public APIs to show user the original SL/TP even if trailing SL/TP are active. This allows users to see both the current effective SL/TP and the original values set at signal creation. The original prices remain unchanged even if _trailingPriceStopLoss or _trailingPriceTakeProfit modify the effective values. Useful for transparency in reporting and user interfaces. Note: originalPriceStopLoss/originalPriceTakeProfit are identical to priceStopLoss/priceTakeProfit at signal creation time.

interface IPublicSignalRow {
    _isScheduled: boolean;
    _partial?: { percent: number; price: number; type: "profit" | "loss" }[];
    _trailingPriceStopLoss?: number;
    _trailingPriceTakeProfit?: number;
    exchangeName: string;
    frameName: string;
    id: string;
    minuteEstimatedTime: number;
    note?: string;
    originalPriceStopLoss: number;
    originalPriceTakeProfit: number;
    pendingAt: number;
    position: "long" | "short";
    priceOpen: number;
    priceStopLoss: number;
    priceTakeProfit: number;
    scheduledAt: number;
    strategyName: string;
    symbol: string;
    totalExecuted: number;
}

Hierarchy (View Summary)

Properties

_isScheduled: boolean

Internal runtime marker for scheduled signals

_partial?: { percent: number; price: number; type: "profit" | "loss" }[]

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)

Type declaration

  • percent: number

    Percentage of position closed (0-100)

  • price: number

    Price at which this partial was executed

  • type: "profit" | "loss"

    Type of partial close: profit (moving toward TP) or loss (moving toward SL)

_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.
_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.
exchangeName: string

Unique exchange identifier for execution

frameName: string

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

id: string

Unique signal identifier (UUID v4 auto-generated)

minuteEstimatedTime: number

Expected duration in minutes before time_expired

note?: string

Human-readable description of signal reason

originalPriceStopLoss: number

Original stop-loss price set at signal creation. Remains unchanged even if trailing stop-loss modifies effective SL. Used for user visibility of initial SL parameters.

originalPriceTakeProfit: number

Original take-profit price set at signal creation. Remains unchanged even if trailing take-profit modifies effective TP. Used for user visibility of initial TP parameters.

pendingAt: number

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

position: "long" | "short"

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

priceOpen: number

Entry price for the position

priceStopLoss: number

Stop loss exit price (must be < priceOpen for long, > priceOpen for short)

priceTakeProfit: number

Take profit target price (must be > priceOpen for long, < priceOpen for short)

scheduledAt: number

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

strategyName: string

Unique strategy identifier for execution

symbol: string

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

totalExecuted: number

Total executed percentage from partial closes. Sum of all percent values from _partial array (both profit and loss types). Represents the total portion of the position that has been closed through partial executions. Range: 0-100. Value of 0 means no partial closes, 100 means position fully closed through partials.