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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        131 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X