Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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
        JesseNinjaTrader Customer Service

        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.

            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by angelgrace11, Today, 08:10 PM
            0 responses
            4 views
            0 likes
            Last Post angelgrace11  
            Started by cryfgg, Today, 05:25 PM
            0 responses
            9 views
            0 likes
            Last Post cryfgg
            by cryfgg
             
            Started by xiinteractive, 02-02-2023, 04:25 PM
            6 responses
            242 views
            0 likes
            Last Post xiinteractive  
            Started by cryfgg, 12-01-2023, 10:12 AM
            7 responses
            123 views
            0 likes
            Last Post Rxxar
            by Rxxar
             
            Started by RayHouston, Today, 04:45 PM
            0 responses
            13 views
            0 likes
            Last Post RayHouston  
            Working...
            X