Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I limit maximum amount of shares an order can have?

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

    How can I limit maximum amount of shares an order can have?

    Hi,


    I’ve been absent for a few months and forgotten how to limit the amount of shares an order can have.

    How can I​ set that?

    Many Thanks, Caesar.

    #2
    Hello Skechers,

    I want to clarify, are you in your code dynamically generating a number of shares or are you asking in general in the user interface? If the question is related to the user interface, a user can enter any default quantity and the strategy will use that value if the DefaultQuantity property is being used. If you are talking about in your code you would limit that by either defining a predetermined quantity in the order method or if you are using a variable you could use Math.Min to take the minimum of two numbers where the pre defined amount is the maximum you wanted.

    Comment


      #3
      I'm executing a strategy and it failed to submit the order due to exceeding the amount of shares allowed. I don't recall setting anything explicitly though. The code is configured to submit an order with a static number of shares.

      Comment


        #4
        Hello Skechers,

        What was the specific error, did it mention entries per direction?

        https://ninjatrader.com/support/helpGuides/nt8/entriesperdirection.htm

        Comment


          #5
          I believe that was the error. However, I haven't encountered the error again.

          Many Thanks!

          Comment


            #6
            Hello Skechers,

            If it was entries per direction you can likely ignore that warning if your strategy is working as intended. If the order failed and you saw that message that would mean it was trying to enter again in the same direction. For example if the strategy enters 1 long contract and then tries to enter 1 more long contract the second is ignored by default because the EntriesPerDirection is set to 1. If your intention was not to enter into the same direction then the platform correctly blocked that order, if the intention was to enter in the same direction you would have to increase EntriesPerDirection to 2 or the total quantity you want to allow in one direction.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X