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 DJ888, Yesterday, 06:09 PM
                2 responses
                9 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                40 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Today, 08:51 AM
                2 responses
                16 views
                0 likes
                Last Post bill2023  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                167 responses
                2,260 views
                0 likes
                Last Post jeronymite  
                Started by warreng86, 11-10-2020, 02:04 PM
                7 responses
                1,362 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X