Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Burst of Data causes Order Placement to be ignored

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

    Burst of Data causes Order Placement to be ignored

    I have the issue of placing an order outside the current market within OnBarUpdate. The issue occurs when a burst of bars occur (sub second) forming an apex either concave or convex. My strat will be processing the nth bar and will place an order when the market is actually at the nth+x bar. NinjaTrader will ignore the order which leaves me in a state of waiting order status. The order types are BuyToCoverStopMarket buy SellStopMarket which are used as trailing Stop orders. The ultimate solution for me would be for NinjaTrader to to execute the order at/as the current market. The worst for me is the current result of ignoring the order. A compromise would be to issue an order reject so that I can continue at the current market price and place a new order. Any thoughts?

    #2
    Hello EWT John,

    Thank you for your note.

    Are you seeing errors in the log tab of the control center?

    If you check the orders tab, are the orders submitted and then canceled or ignored all together?

    Which syntax at the following link are you using for EnterShortStopMarket? For example,
    EnterShortStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName)


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

    Comment


      #3
      Yes, I see errors something like this in the Log on the main console window:

      Time Category Message
      6/26/2018 12:02:22 PM Default Strategy 'X-1': A BuyToCover stop order placed at '6/11/2018 7:12:56 PM' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.

      I can reproduce in Strategy Analysis and it occurs with a Short Position.

      Instrument is GC 08-18 I am using the following order placement:
      ExitLongStopMarket(0,true,oi.shares,oi.price,oi.or derID,oi.fromOrderID);
      ExitShortStopMarket(0,true,oi.shares,oi.price,oi.o rderID,oi.fromOrderID);

      Long Example:
      The market will be 200.05x200.15 (nth+x bar) and I am Long. My view of the market is a Close[0] of 200.45. I attempt to place a ExitLongStopMarket at 200.25 (20 ticks below the (nth bar) market). This order is intended to be placed below the market as the market moves up. The market actually moves up but retraces faster causing the order to be placed above the market. The Chart (using the data viewer) will clearly show the bars occurring sub second.
      Last edited by EWT John; 06-26-2018, 10:08 AM.

      Comment


        #4
        Hello EWT John,

        If you attempt to place a stop to close to the market you should expect order rejections. You should work your stop further from the market to avoid these order rejections, 10 cents on a $200 instrument with a bid as spread of 10 ticks is very small.

        Another option would be to handle order rejections for which I have provided a sample script of how this may be done. So that an order is submitted, its rejected for being too close, and a new order is submitted.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the responses Alan. I never get a reject for the order placed. I have debug in the OnOrderUpdate(). Here is my debug output from running an analysis that reproduces the issue. As you can see the data comes in sub second and you can see Bar OHLC when I place the order which is $1 above the market as I know it. I do wait for the cancels to occur before placing the new cover order. Instrument is GC 08-18.

          A 6/11/2018 7:10:29 PM: BarUpdate: 1304.1, 1304.1, 1303.3, 1303.3
          A 6/11/2018 7:12:56 PM: BarUpdate: 1303.7, 1303.7, 1302.9, 1302.9
          A 6/11/2018 7:12:56 PM: Signal Event EnterShort:
          A 6/11/2018 7:12:56 PM: ShortMarket [email protected]
          A 6/11/2018 7:12:56 PM: BarUpdate: 1303.3, 1303.3, 1302.5, 1302.5
          A 6/11/2018 7:12:56 PM: Filled P1-007 [email protected]
          A 6/11/2018 7:12:56 PM: OnPosition(): Short [email protected]
          A 6/11/2018 7:12:56 PM: BuyToCoverStopMarket [email protected]
          A 6/11/2018 7:12:56 PM: BarUpdate: 1302.9, 1302.9, 1302.1, 1302.1
          A 6/11/2018 7:12:56 PM: BarUpdate: 1302.5, 1302.5, 1301.7, 1301.7
          A 6/11/2018 7:12:56 PM: BarUpdate: 1302.1, 1302.1, 1301.3, 1301.3
          A 6/11/2018 7:12:56 PM: BarUpdate: 1301.7, 1301.7, 1300.9, 1300.9
          A 6/11/2018 7:12:56 PM: BarUpdate: 1301.3, 1301.3, 1300.5, 1300.5
          A 6/11/2018 7:12:56 PM: Cancel 0@0
          A 6/11/2018 7:12:56 PM: BuyToCoverStopMarket [email protected]
          Strategy 'A/-1': A BuyToCover stop order placed at '6/11/2018 7:12:56 PM' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.
          A 6/11/2018 7:12:56 PM: BarUpdate: 1300.9, 1300.9, 1300.1, 1300.1
          A 6/11/2018 7:12:56 PM: BarUpdate: 1300.5, 1301.3, 1300, 1301.3
          A 6/11/2018 7:12:56 PM: BarUpdate: 1300.9, 1301.7, 1300.9, 1301.7
          A 6/11/2018 7:12:56 PM: BarUpdate: 1301.3, 1302.1, 1301.3, 1302.1
          A 6/11/2018 7:12:56 PM: BarUpdate: 1301.7, 1302.5, 1301.7, 1302.5
          A 6/11/2018 7:12:56 PM: BarUpdate: 1302.1, 1302.9, 1302.1, 1302.9
          A 6/11/2018 7:12:56 PM: BarUpdate: 1302.5, 1303.3, 1302.5, 1303.3
          A 6/11/2018 7:52:03 PM: BarUpdate: 1302.9, 1303.4, 1302.1, 1302.1
          A 6/11/2018 8:04:33 PM: BarUpdate: 1302.5, 1302.5, 1301.7, 1301.7
          A 6/11/2018 8:12:12 PM: BarUpdate: 1302.1, 1302.1, 1301.3, 1301.3

          I would like to get a reject and react if possible.
          Last edited by EWT John; 06-26-2018, 11:20 AM.

          Comment


            #6
            Hello EWT John,

            Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader8>Log and My Documents>NinjaTrader8/Trace folders.

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

            Comment


              #7
              This issue occurs because I am using a custom DataSeries that computes bars based on a fixed tick size. When the market prints more than 2*(tick size) away the custom code will add two bars. The strat will attempt to place Stop Orders based on a bar update which is actually inside the last print and the current print. This will result in a reject. What I have done is I watch the Time Stamp on each bar and if the current bar has the same time as the last bar I know to place stop orders outside the last bar. This issue is resolved.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 02:12 AM
              7 responses
              30 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by guillembm, Yesterday, 11:25 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by junkone, 04-21-2024, 07:17 AM
              10 responses
              149 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by tsantospinto, 04-12-2024, 07:04 PM
              6 responses
              101 views
              0 likes
              Last Post tsantospinto  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              7 responses
              28 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X