Function getEffectivePriceOpen

Returns the effective (DCA-weighted) entry price for a signal.

Uses cost-weighted harmonic mean: effectivePrice = Σcost / Σ(cost/price) This is the correct formula for fixed-dollar DCA positions where each entry has its own cost (e.g. $100, $200, etc.).

When partial closes exist, iterates through all partials to maintain a running effective price, then blends with any new DCA entries after the last partial:

  • partial[0]: effectivePrice = costBasisAtClose[0] / Σ(cost/price for entries[0..cnt[0]])
  • partial[j>0]: remainingCB = prev.costBasisAtClose * (1 - prev.percent/100) oldCoins = remainingCB / prevEffPrice blend with new entries between prev and curr partial
  • final: blend remaining position with entries added after last partial
  • Parameters

    • signal: Signal$1

      Signal row with _entry and optional _partial

    Returns number

    Effective entry price for PNL calculations