Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

within code : "Set Order quantity", "Default quantity"

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

    within code : "Set Order quantity", "Default quantity"

    Hello,

    I would like to set these settings within my strategy code by default :
    - Set order quantity
    - Default quantity

    ...as per my screenshot.

    I know that I can enforce TimeInForce setting by adding this line inside Initialise() chapter :
    TimeInForce = Cbi.TimeInForce.Day;

    Is there something similar for the above 2 settings ? Thank you
    Attached Files

    #2
    Hello SARdynamite,
    If you try the below code then are you able to get it work.

    Code:
    this.QuantityType = QuantityType.DefaultQuantity;
    this.DefaultQuantity = 100;
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Yes indeed ! Have a nice day.

      Comment


        #4
        How would I go about coding dynamic position size
        This is what I have come up with, would this work?

        Private int LossLimit = 200
        DefaultQuantity = :LossLimit / ATR(14)[0]

        Comment


          #5
          Hi Fiddy,

          Thank you for your post.

          The only issue I see is that the LossLimit/ATR(14)[0] may return a double number rather than an int that the default quantity needs.
          Cal H.NinjaTrader Customer Service

          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