Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ETFVoyageur, 05-07-2024, 07:05 PM
            17 responses
            133 views
            0 likes
            Last Post ETFVoyageur  
            Started by ETFVoyageur, Today, 10:13 PM
            1 response
            7 views
            0 likes
            Last Post ETFVoyageur  
            Started by somethingcomplex, Today, 10:36 PM
            0 responses
            6 views
            0 likes
            Last Post somethingcomplex  
            Started by sofortune, Yesterday, 10:28 AM
            5 responses
            22 views
            0 likes
            Last Post sofortune  
            Started by guyonabuffalo, Today, 10:01 PM
            0 responses
            4 views
            0 likes
            Last Post guyonabuffalo  
            Working...
            X