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 ScottW, Today, 06:09 PM
          0 responses
          2 views
          0 likes
          Last Post ScottW
          by ScottW
           
          Started by Board game geek, 10-29-2023, 12:00 PM
          14 responses
          244 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Waxavi, 04-19-2024, 02:10 AM
          4 responses
          56 views
          0 likes
          Last Post sonia0101  
          Started by cmtjoancolmenero, Today, 03:58 PM
          0 responses
          9 views
          0 likes
          Last Post cmtjoancolmenero  
          Started by Segwin, 05-07-2018, 02:15 PM
          11 responses
          1,779 views
          0 likes
          Last Post aligator  
          Working...
          X