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:
    http://www.ninjatrader-support.com/H...luesClass.html

    http://www.ninjatrader-support.com/H...rofitLoss.html

    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?
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by t.kelly4149, Today, 05:36 PM
        1 response
        8 views
        0 likes
        Last Post bltdavid  
        Started by SilverSurfer1, Today, 06:29 PM
        0 responses
        17 views
        0 likes
        Last Post SilverSurfer1  
        Started by trader3000a, Today, 01:06 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by marcus2300, Today, 11:45 AM
        3 responses
        31 views
        0 likes
        Last Post marcus2300  
        Started by pel11, Today, 11:06 AM
        0 responses
        13 views
        0 likes
        Last Post pel11
        by pel11
         
        Working...
        X