• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Split order

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

    Split order

    I would like to split an enter long order on 10 contracts into 10 enter long order on 1 contracts. Is there an easy way to do that in strategies?
    Many thanks

    #2
    Hello paul.cabot,

    So I can best answer your question, would you be able to provide more information?

    Instead of submitting a buy order for 10 contracts you wish to submit 10 orders for 1 contract each when your buy condition becomes true?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      yes, exactly, I want to submit 10 orders for 1 contract each when your buy condition becomes true
      This is to break the 10 contracts order into 10 smaller orders
      Thanks

      Comment


        #4
        Hello paul.cabot,

        To do this I sent EnteryHandling to Unique Entries and uniquely named 10 different EnterLong calls.

        Please see EntryHandling section of our helpguide and import the attached sample.
        https://ninjatrader.com/support/help...ryhandling.htm

        Please let us know if you need further assistance.
        .
        To Import a NinjaScript into NinjaTrader 8 do the following:
        From the Control Center window select Tools -> Import-> NinjaScript...
        Find the file location.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          If the total order size x is variable from day to day and the chunks are to be random numbers between 1 and 4 lots what method (loop?) is best to get that done and what order object is best employed?
          Regards and many thanks

          Comment


            #6
            Yes, use a loop. The 'order object' is no different than before.

            To submit an order with a random quantity Y between 1 and 4 until X contracts
            have been submitted, you first need a way to get a random number,
            Code:
            private static Random MyRand = new Random(DateTime.Now.Millisecond);
            then makeup a function, something like,
            Code:
            private void EnterOrder(int Direction, int totalQuantity)
            {
                int orderNum = 1;
                while (totalQuantity > 0)
                {
                    int quantity = Math.Min(MyRand.Next(1, 4), totalQuantity);
                    if (Direction > 0)
                        EnterLong(quantity, "L"+orderNum);
                    else if (Direction < 0)
                        EnterShort(quantity, "S"+orderNum);
                    totalQuantity = totalQuantity - quantity;
                    ++orderNum;
                }
            }
            which works well with these 'direction' integer constants,
            Code:
            private const int SHORT = -1;
            private const int NONE = 0;
            private const int LONG = 1;
            then, to enter random orders for a 10 contract position, call it like this,
            Code:
            EnterOrder(LONG, 10);
            Make sense?

            Comment


              #7
              Yes thx that gives me something to work from. Very much appreciated. Thank you

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by KNalley, Today, 09:33 AM
              0 responses
              4 views
              0 likes
              Last Post KNalley
              by KNalley
               
              Started by AMATX, Today, 09:29 AM
              0 responses
              4 views
              0 likes
              Last Post AMATX
              by AMATX
               
              Started by arnegockeln, Today, 09:25 AM
              0 responses
              1 view
              0 likes
              Last Post arnegockeln  
              Started by herkok, Today, 09:15 AM
              0 responses
              12 views
              0 likes
              Last Post herkok
              by herkok
               
              Started by itrader46, Today, 07:51 AM
              2 responses
              21 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X