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 cre8able, Yesterday, 09:15 PM
            2 responses
            14 views
            0 likes
            Last Post cre8able  
            Started by Trader146, Today, 09:17 PM
            0 responses
            6 views
            0 likes
            Last Post Trader146  
            Started by ttrader23, 05-08-2024, 09:04 AM
            9 responses
            43 views
            0 likes
            Last Post ttrader23  
            Started by ZeroKuhl, Yesterday, 04:31 PM
            8 responses
            46 views
            0 likes
            Last Post ZeroKuhl  
            Started by reynoldsn, Today, 07:04 PM
            0 responses
            11 views
            0 likes
            Last Post reynoldsn  
            Working...
            X