Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AccountSize and PnL

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

    AccountSize and PnL

    So I understand we have to keep track of account size etc. but how do we get the profit and loss from each trade after it has been closed? Does the Position.GetProfitLoss() return the TOTAL profit and loss since running or for the last position etc? I am trying to compound my trades...for instance...

    orderSize = AccountSize * some value etc.

    #2
    Hello,

    You can do this with the Trade Class and Trade Collection Class.

    These links will help you wiht Classes Trade and Trade Collection:



    Here is a reference sample on how to manage this:
    DenNinjaTrader Customer Service

    Comment


      #3
      Account size and P&L

      I am trying to use the Performance.AllTrades.TradesPerformance.Currency.C umProfit in attempt to add it to my starting account value. From there I would like to calculate a % of this total from which I could derive the max position size. I am attemtping to build this into an indicator so that it is not hard coded into a strategy. I get the error "The name Performance does not exist in the current context." This is my first endeavor into programming and do not know what this means? Is it not allowed as part of an indicator? Is there any code out there that successfully uses this statement to adjust position size?

      Thanks for your help.

      Comment


        #4
        Hello,

        "The name Performance does not exist in the current context."

        Means that you are using something out of scope. In this case you are trying to access trade information in an indicator. You can only do this in a strategy.

        The sample link I provided is a good place to start learning how to use performance information.
        DenNinjaTrader Customer Service

        Comment


          #5
          Hello Ben - Would you kindly confirm the links to these classes? I've attempted to access them but it appears the links are no longer active. I would greatly appreciate an update!

          Thank you for your consideration,
          Ashley

          Comment


            #6
            Hello ashlantz,

            Thanks for writing in.

            These links are expired - here are the links to the Trade and Trade Collection classes:

            Trade - http://ninjatrader.com/support/helpGuides/nt7/trade.htm

            TradeCollection - http://ninjatrader.com/support/helpG...collection.htm

            Please let me know if I may be of any further assistance.
            Alan S.NinjaTrader Customer Service

            Comment


              #7
              Hi Alan - Thanks for the response, do you also have an updated link to a reference sample on using this? As posted earlier?

              Thanks,
              Ashley

              Comment


                #8
                Hello Ashley,

                Thanks for your reply.

                There are reference samples for each of these classes in our help guide - please let me know if you have any difficulty locating the examples.

                Please let me know if I may be of any further assistance.
                Alan S.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Aviram Y, Today, 05:29 AM
                0 responses
                2 views
                0 likes
                Last Post Aviram Y  
                Started by quantismo, 04-17-2024, 05:13 PM
                3 responses
                25 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by ScottWalsh, 04-16-2024, 04:29 PM
                7 responses
                34 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by cls71, Today, 04:45 AM
                0 responses
                6 views
                0 likes
                Last Post cls71
                by cls71
                 
                Started by mjairg, 07-20-2023, 11:57 PM
                3 responses
                217 views
                1 like
                Last Post PaulMohn  
                Working...
                X