Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Equity calculation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Equity calculation

    Hello,
    I'm trying to calculate the running/ongoing equity curve for a strategy. I see a lot of posts asking about this but I see no solution/formula. So below I'm sharing the calculation I've come up with.

    Does this seem correct?

    Equity = (AccountSize + Performance.AllTrades.TradesPerformance.Points.Cum Profit + (Math.Round(Position.GetProfitLoss(Close[0], PerformanceUnit.Points), 4, MidpointRounding.ToEven) * Position.Quantity))

    I'm using this formula within OnBarUpdate to get a continuous equity curve.

    I'm not sure whether to use Points or Currency. For equities are both the same?

    Regards.

    #2
    sajosh,

    Points will be in "ticks" essentially and currency will be in actual currency. You need to be sure you calculation has either all variables in points, or all variables in currency.

    An equity curve is a change in value of an account/portfolio over time minus margin requirements. As such, you could add AccountSize + CumulativeProfit - Margin to get something like what you need. Cumulative profit takes into account losses as well so I am not sure you need the :

    (Math.Round(Position.GetProfitLoss(Close[0], PerformanceUnit.Points), 4,MidpointRounding.ToEven) * Position.Quantity)
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Between a trade entry and exit, the Cumulative Profit stays the same value on each bar update. I'd like to see the value change per bar update. So GetProfitLoss seems to accomplish this. Does that seem right to you?

      Comment


        #4
        Hello,

        Correct, this would get just the current trade PnL however it would update with each new OnBarUpdate().

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        630 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        566 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X