Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Default Quantity

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

    Setting Default Quantity

    Hi,

    when I'm in the strategy wizard, I go to the order management tab to program an "enter long position" and I type 200000 for the quantity in the space that says "Quantity" and that's been working fine. But, before I write that in, there is already the words "Default Quantity" and I was wondering how I can set that default quantity to always be 200000 so that I wouldn't have to keep typing it in.

    Thank you.

    #2
    Hello Werido,

    You can set DefaultQuantity in the Initialize method.

    protected override void Initialize()
    {
    DefaultQuantity = 200000;
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks. Is there a way to do that in the Strategy Wizard window?

      Comment


        #4
        Thanks for the reply. With the strategy wizard you would have to change this slightly.

        First create a User Defined Inputs for your order quantity and set the default of this to 200000.

        Then, within your order placement actions, select this input for your quantity.
        Attached Files
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi Ryan,

          Wouldn't it make sense to have a DefaultQuantity field in the simulator tab (please see attachment) rather than having to set it in using code?

          I always use 500 as my DefaultQuantity and so I usually have to make a semi-redundant variable in my strategy called 'Amount'.

          It'd cut down on a bit of time if you always use the same DefaultQuantity across all of your strategies, in the same way we define a commission for all strategies.

          Cheers
          Attached Files

          Comment


            #6
            Thanks for the thought Scotty, have added this item to our feedback tracking list (#2901).

            You generally can also set a default quantity from the UI directly - it will then override what the strategy internally uses.

            Comment


              #7
              Hi Bertrand,

              Sorry, but where in the UI can I do this?

              Thanks

              Comment


                #8
                Scotty, when you add your strategy...go to the order properties section and choose to set your quantity ByDefaultQuantity, then enter your amount.

                Comment


                  #9
                  Ah, do you mean as I've done in the attachment?
                  Attached Files

                  Comment


                    #10
                    You're mixing up two UI's here. For running the script the left section in SA would be important, as here in the lower order properties section you can override what the strategy would do as qty per code. Choose here ByDefaultQuantity and then enter your amount directly.

                    Comment


                      #11
                      Changing execution quantity according to vol

                      How can you change the size of execution if for example the ATR is above a certain level?

                      This is the current code for execution...

                      {
                      EnterLong(DefaultQuantity, "Long");
                      }

                      I tried doing it with this snippet after onbarupdate... doesnt work.--- compiles but doesnt change the size traded.


                      if (DailyATR(5)[0] > 15
                      && DefaultQuantity >1)
                      {
                      DefaultQuantity = DefaultQuantity/2;
                      }
                      else
                      {
                      DefaultQuantity = DefaultQuantity;
                      }

                      Comment


                        #12
                        everington_f, from the UI then how does the script determine order qty by, is this set to ByDefaultQuantity or ByStrategy still?

                        Comment


                          #13
                          I currently adjust the default quantity in the UI window, and set the size via "default Quantity".




                          EntryHandling = EntryHandling.AllEntries;
                          EntriesPerDirection = 1;
                          CalculateOnBarClose = false;
                           
                          TraceOrders = true;
                          ExitOnClose = true;
                          TimeInForce = Cbi.TimeInForce.Gtc;
                          DefaultQuantity = 1;

                          }

                          protected override void OnBarUpdate()
                          {
                           
                           
                          //************************

                          if (DailyATR(5)[0] > 75
                          && DefaultQuantity >1)
                          {
                          DefaultQuantity = DefaultQuantity/2;
                          }
                          else
                          {
                          DefaultQuantity = DefaultQuantity;
                          }
                          Last edited by elliot5; 12-15-2014, 10:34 AM. Reason: update

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          648 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          369 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          108 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          572 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          574 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X