Skip to main content

Replay mode: Portfolio.ClosedPnL always returns 0

TradingManager.Portfolio.ClosedPnL always returns 0 during Market Replay — OnPortfolioChanged never fires at all in replay mode. The only workaround is to regex-parse position.ToString() to extract the closed P&L string, which is fragile and undocumented.

Request: make Portfolio.ClosedPnL (and OnPortfolioChanged) work correctly in replay mode, the same as in live/paper trading. Strategy developers rely on closed P&L to enforce daily loss limits, profit goals, and session resets — none of these work in replay without this fix, making replay useless for strategy validation.

2 comments

Log in to comment and vote

Comments2

  • Jorge

    •

    Sep 23

    •

    Merged request

    •

    1 vote

    Methods OpenPnL and ClosedPnL

    Next code works fine on Real or Sim account:

    var trades = TradingManager.MyTrades; if (trades != null) {

    foreach (var tra in trades)
    {
        
        vgOpenPNL = Math.Round((double)tra.Portfolio.OpenPnL, 2);
    

    Also next code:

    this.TradingManager.Portfolio.ClosedPnL

    But for Replay, both methods do not get nothing. Will be great if this method works with Replay also. Thanks.

  • Robert

    •

    Apr 14

    never mind, just delete this request.