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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          72 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          39 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X