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 abelsheila, Yesterday, 07:38 PM
            0 responses
            6 views
            0 likes
            Last Post abelsheila  
            Started by nailz420, Yesterday, 09:14 AM
            1 response
            41 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
            0 responses
            273 views
            0 likes
            Last Post NinjaTrader_Brett  
            Started by domjabs, 05-12-2025, 01:55 PM
            2 responses
            56 views
            0 likes
            Last Post domjabs
            by domjabs
             
            Started by Morning Cup Of Trades, 05-12-2025, 11:50 AM
            1 response
            59 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X