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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        162 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        312 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X