Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position Sizing Question

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

    Position Sizing Question

    Hello All-

    Please see the attached trade for reference.

    I have built a strategy that will take trades of 2,4,6,8, etc contracts which the user can set as a input when enabling the strategy.

    Then I want the strategy to sell half of the total contracts at a certain profit target and let the rest go as runners.

    In the attached screenshot the strategy is set up to trade 2 contracts.

    Question, if the strategy buys 1 contract and then another 1 contract to get a the full desired position size of two, does Ninjatrader count that as a position size of 2 when I use the following code to exit half the position, ExitLong(Position.Size / 2 )

    Or does the Ninjatrader code treat these as two separate positions of 1 contract each?


    Hopefully this question makes sense.

    Thank you,

    Nick


    #2
    Hello njmeyer713,

    Thanks for your post.

    Position.Size would not be a valid argument to get the current position size. You would need to use Position.Quantity instead to get the current position size.

    See the help guide pages below for more information about Position methods/properties and Position.Quantity.

    Position: https://ninjatrader.com/support/help...8/position.htm
    Position.Quantity: https://ninjatrader.com/support/help...n_quantity.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Brandon,

      Thank you for the response. So if I use the correct code with Position.Quantity, how will it calculate the quantity? As one position with 2 contracts or 2 different positions with 1 contract each?

      Thank you,

      Nick

      Comment


        #4
        Hello njmeyer713,

        Thanks for your note.

        Position.Quantity would refer to the total current position size seen in the Position column of the Strategies tab on the Control Center.

        So if your strategy has placed a total quantity of 2 long orders, the Positions column in the Strategies tab on the Control Center would report 2 long and Position.Quantity would return 2.

        Please let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X