Function getPositionHighestProfitDistancePnlCost

  • Returns the distance in PnL cost between the current price and the highest profit peak.

    Computed as: max(0, peakPnlCost - currentPnlCost). Returns null if no pending signal exists.

    Parameters

    • symbol: string

      Trading pair symbol

    Returns Promise<number>

    Promise resolving to drawdown distance in PnL cost (≥ 0) or null

    import { getPositionHighestProfitDistancePnlCost } from "backtest-kit";

    const dist = await getPositionHighestProfitDistancePnlCost("BTCUSDT");
    // e.g. 3.2 (gave back $3.2 from peak)