Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What is the profit of a position

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

    What is the profit of a position

    I have a strategy to which I now want to add money management. I basically want to enter with 4 contracts and then sell 2 when I am up a certain profit in the position.

    I have looked at the reference samples and have search the board but could not find a good example.

    I cannot use the setprofittarget because the last 2 contracts (letting the winner run) is excited with a normal exitlongstop which is never called when I use setprofittarget.

    I have found stuff about the "position" object that has something that could be use to get profit but that seems to be when multiple instruments are traded

    Regards

    Verge

    #2
    Verge,

    Perhaps this reference will help you: http://www.ninjatrader-support2.com/...ead.php?t=4084
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Looks like I need to use TradesPerformanceValues Class

      Josh

      As always - thank you for the lighting reply.

      I have had a look at that reference sample. It shows how to calculate the accumulated profit for the session.

      I am not sure how to change it to look at only the profit of the trade I am in at a certain point. Maybe a good idea for another reference sample?

      Regards

      Verge

      Comment


        #4
        If you want the unrealized PnL of a trade you are currently in please use this: http://www.ninjatrader-support.com/H...rofitLoss.html
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Can getprofitloss be used in multitimeframe

          Great

          I will use it. Is there a way to use it in a multitimeframe strategy. I am using multitimeframe in my backtest so that I am not forced to use close[0] in the time frame that I am trading in - similar to the reference sample called something like "intrabartesting"

          Now that I think about it - is it as simple as including the getprofitloss in the if barsinprogress ==1 section of my code?

          Regards

          Verge

          Comment


            #6
            Yes, just use it in the BarsInProgress context you want to use.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 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
            567 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