Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unrealized + realized profits?

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

    Unrealized + realized profits?

    I'm trying to add the prior trades results with the unrealized profit of an open position.

    priorTradesCumProfit = Performance.RealtimeTrades.TradesPerformance.Curre ncy.CumProfit;

    if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit - priorTradesCumProfit >= 1000.

    ^^ I got this from Josh's sample code.

    I searched and found GetProfitLoss.


    So then I would have

    if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit - priorTradesCumProfit + Position.GetProfitLoss (Close[0], PerformanceUnit.Points >= 1000.

    Something like that I think? Am I on the right track?

    #2
    Hello,

    To add Realized and Unrealized do something like this:


    Performance.RealtimeTrades.TradesPerformance.Curre ncy.CumProfit + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)

    These links will help:




    Notice that you must add currency values to currency values, not point values to currency, etc. Also, this will included all Cum. profit not just the days P and L. To take out the prior trade Cum. profit you will need to treat priorTradesCumProfit in the manner it was treated in the sample: inside the if(Bars.FirstBarOfSession) block.
    DenNinjaTrader Customer Service

    Comment


      #3
      ^^^ Thanks. Got it working exactly how I wanted/

      Comment


        #4
        Hello gplatis,

        Thanks for your post.

        The links in the thread are out of date.

        Here are the current NT7 helpguide links to the subjects of CumProfit and GetProfitLoss (unrealized PNL). Each of these links provides a specific example of utilization.

        http://ninjatrader.com/support/helpG...?cumprofit.htm

        http://ninjatrader.com/support/helpG...profitloss.htm

        Can you clarify what you are asking for, "...how do you take out the priorTradesCumProfit ??" I'm not entirely sure what you mean. Do you mean to obtain the last trades PNL or the current PNL of the strategy?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        68 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        39 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X