Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Investing a percentage of the whole account

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

    Investing a percentage of the whole account

    Hello

    what do I have to do, that NT uses each trade 10% of the actual Cash available instead of a fixed quantity?

    For example I invest with a capital of 10'000 1'000 in the first trade. I close it with 1'000 win. In the next trade, it shall invest 1'100 and so on.

    How do I do this (with rounding down, so max. 10% of the total cash investing)?

    Thanks in advance

    Sepp

    #2
    Strangely, NT doesn't support this out of the box. You have to handle your own account size calculations and calculate a position size based on the account size using custom code. Hopefully, this is something we'll see supported out of the box in NT 7.x. Lots of us would like to see a few basic built-in position sizing algorithms that you can apply to any strategy, and then ability to write your own algorithm and apply it to any strategy, similar to WealthLab, etc.

    Comment


      #3
      Ok, I see... for the custom code it would look like: Quantity X
      X = AccountSize/CurrentPrice. But how do I get the actual account size? I mean the account size where win and loss of the trades before are already calculated. Is there any command like this?

      Regards,

      Sepp

      Comment


        #4
        You don't have built-in access to your broker's exact account size in NT 6.5. You would need to start your strategy with some kind of parameter that specifies the current account size, and then you write code to manually update the account size after each trade (using stuff like Performance.AllTrades.TradesPerformance.Currency.C umProfit and Position.GetProfitLoss, etc.). If you search these forums for "+position +size +percent +algorithm" and some similar variations, you'll find several discussions on this topic.

        Comment


          #5
          Thank you for your help.
          My problem is actually, that EnterShort/Long() needs an int as quantity, which is an absolute number. But I have to insert a double parameter, which changes after each OnBarUpdate(). Is there any possibility to enter a quantity, which varies depending on the total AccountSize?

          Regards,

          Sepp

          Comment


            #6
            Sepp, you could set order quantity 'by account' - http://www.ninjatrader-support.com/H...AStrategy.html

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              Note that the AccountSize property doesn't reflect your actual brokerage account size (it isn't available in NT 6.5) and does not update as trades complete to reflect any gains/losses. AccountSize is only a static property you input in your strategy parameters to specify a fixed maximum position size, not one based on a dynamic/changing account size. To position size based on a % of a real or virtual account size that grows or shrinks as trades complete, you have to take your gain/loss and add it to your starting balance from when the strategy started. For details, see my test case here:
              Support for the development of custom automated trading strategies using NinjaScript.

              Comment


                #8
                But this also gets a double parameter. What I need is a int parameter, that reflects my actual accountsize, for that I can enter it in the EnterShort() command.

                Comment


                  #9
                  MasterSepp, unfortunately you can't access your live account stats in NinjaTrader 6.5 - this will be added for 7 - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html

                  New Account Access
                  We added methods to get access to live brokerage account values such as cash balance. This is dependant on the broker and the level of information they provide if any.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  576 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  553 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X