Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit orders - book position kept when new orders are generated

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

    Limit orders - book position kept when new orders are generated

    I would like to have some insight into the ways Ninja handles Limit orders when a limit order has been sent at a price P and a new Limit order is sent at the same price P (order not amended but a new order).

    Does ninja leave the original order in the book queue (as it is the same price) and allocates that order (and therefore keep the position in the queue) to the new limit order generated or does it cancel the order in the queue and send a new order to the exchange (losing the position in the queue)?

    When setting up in a strategy, CalculateOnBarClose = false in the Initiliaze function to make sure my orders are computed at each tick received (orders computed in context 0, ie BarsInProgress == 0).

    I update some variables every N ticks, from those variables I generate a Limit orders at every tick. The value of the limit order only changes every N ticks but at every tick I send a new order.

    Does Ninja is smart enough to recognize that a previous order was positionned in the book at a price P at the previous tick and when a new order is generated at price P at the current tick, leaves the previous order in the queue and does not in fact send a new order to the exchange. Sending a new order would lose the priority in the book ?

    I read in the documentation somewhere that Ninja should behave that way but I thought I would better ask the question ...

    Thanks,
    Fabrice.



    #2
    >> new Limit order is sent at the same price P
    Not sure I follow.

    Are you:
    a) placing a new order based on different entry signal
    e.g. EnterLongLimit(price, "newSignal") OR
    b) are you calling the same entry signal again e.g. EnterLongLimit(price)

    On a): NT submits a new order
    On b): NT will not touch the order which is already in the market provided the price did not change

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      >> new Limit order is sent at the same price P
      Not sure I follow.

      Are you:
      a) placing a new order based on different entry signal e.g. EnterLongLimit(price, "newSignal") OR
      b) are you calling the same entry signal again e.g. EnterLongLimit(price)

      On a): NT submits a new order
      On b): NT will not touch the order which is already in the market provided the price did not change
      My code:

      if (BarsInProgress == 0)
      {
      EnterShortLimit(NumContractsToTrade, pEntryShort, "Enter Short");
      EnterLongLimit(NumContractsToTrade, pEntryLong, "Enter Long");
      }

      at each tick but the pEntryShort and pEntryLong varies only every N ticks. The "Enter Short" and "Enter Long" never change so I presume I am in case (b) ?

      So my signal name entry does not change during the N ticks duration period but that order is generated at each tick.

      I am using a strategy with a target Limit order and I want my target limit order to be sent (exit my position) after N milliseconds if the market has quoted my price but my order was not filled. To be able to timestamp the first quotation at my limit price I need to track all incoming ticks and generate orders at the tick level. I just want to make sure I do not lose my position in the book.

      I am not sure if there is an automated way to fire Limit orders as market order after a given number of milliseconds if my order was not filled (on a high or low of a bar for example) after the first quotation at my limit order price.

      Ninja is a good product. I found few bugs here that I will document in the forum.

      Thanks for your previous answer,
      Fabrice.

      Comment


        #4
        Right, scenario (b) -> no issue

        Sorry there is no support for a timer driven approach in NT. You would need to handle this by custom coding. Please contact e.g. a NinjaTrader consultant if you would need support on how to do that: http://www.ninjatrader.com/webnew/pa...injaScript.htm

        Comment


          #5
          Thanks for your reply, good.

          I wrote a strategy with the approach I specified earlier. I have been following Ninja trader since the beginning, great product.

          I might have found some bugs, will report them to the forum a bit later.

          Thanks again,
          Fabrice.

          Comment


            #6
            Hi. Did you ever accomplish turning a limit order to a market order after a certain time period? If so, I would appreciate seeing the code. I would like to do the same thing.

            Thanks,

            Folls

            Comment


              #7
              Code:
              if (Close[0] > Close[1])
              {
                  if (entryTimeSet == false)
                  {
                      enterTime = Time[0];
                      entryTimeSet = true;
                  }
              
                  if (Time[0] < enterTime.AddMinutes(10) && Position.MarketPosition == MarketPosition.Flat)
                      EnterLongLimit(100, "Long Limit");                
                  else if (switchedToMarket == false && Position.MarketPosition == MarketPosition.Flat)
                  {
                      EnterLong();
                      switchedToMarket == true;
                  }
              
                  if (Position.MarketPosition == MarketPosition.Long)
                  {
                      entryTimeSet = false;
                      switchedToMarket == false;
                  }
              }
              See if this works out for you. I haven't tested it though.
              Last edited by NinjaTrader_JoshP; 10-13-2007, 03:19 PM.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kevinenergy, 02-17-2023, 12:42 PM
              115 responses
              2,699 views
              1 like
              Last Post kevinenergy  
              Started by prdecast, Today, 06:07 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by Christopher_R, Today, 12:29 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by chartchart, 05-19-2021, 04:14 PM
              3 responses
              577 views
              1 like
              Last Post NinjaTrader_Gaby  
              Started by bsbisme, Yesterday, 02:08 PM
              1 response
              15 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X