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

unmanaged order - ignored

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

    unmanaged order - ignored

    I am stresstesting my unmanaged orders code module to make sure I understand all the edge cases

    Currently the strategy (at random times), does the following at bar close

    1. [ENTRY] Place a Market Stop sell order at the current bar low - 1 tick
    2. Remember the current bar high
    3. [ACTIVATION] once this order from (1) gets a fill, check the level of the Close[0] vs entry_bar_high+3ticks.
    3.a. if that level is higher than the market, place a stop market buy order at the entry bar's high + 3 ticks
    3.b. if not, then do a market order

    however, what I am seeing is that sometimes (in about 10 cases over 2000 orders), the orders from (3a) get ignored. In some instances the stop price as determined by entrybarhigh+3ticks is sometimes very close to the Close so first I thought that might be why. But if I focus on this 1 example and don't allow execution of any of the previous orders, then the orders go through just fine.

    The granularity i am using is 1min bars.

    So my questions are
    * What exactly are the rules to determine an order, in the unmanaged setting, gets ignored? I assume the stop price has to be well above the close. But how much is well enough?
    * Is there a way to list all the outstanding working orders? That way I can cross check if there are maybe other orders (buy or sell) with the same stop price
    * if I take the returned object from SubmitOrderUnmanaged, it always seems to be null when those orders are ignored. Is that the best programmatic way to check if an order is ignored? Are there possible scenarios where this returns null but the order has gone through?
    * Is the behaviour rhe same in backtest as in real time?

    Looking forward to your responses

    #2
    Hello crystalet,

    Thanks for your post.

    * What exactly are the rules to determine an order, in the unmanaged setting, gets ignored? I assume the stop price has to be well above the close. But how much is well enough?
    This should just be the fill prices of the order with historical processing. With realtime, orders that would be rejected will be submitted and will receive a rejection. Realtime orders need to be on the correct side of bid/ask. Historical orders must be on the proper side of the Close price. Note also that with historical processing "virtual bars" are created to simulate how the market would move within a bar.

    * Is there a way to list all the outstanding working orders? That way I can cross check if there are maybe other orders (buy or sell) with the same stop price
    You can track OnOrderUpdate to see the orders submitted by the strategy, Be sure to null orders when filled, cancelled, or rejected to note they are no longer active.

    * if I take the returned object from SubmitOrderUnmanaged, it always seems to be null when those orders are ignored. Is that the best programmatic way to check if an order is ignored? Are there possible scenarios where this returns null but the order has gone through?
    I have not seen cases where this is null but an order has gone through. I would expect there to be a reason for the order to be ignored while processing historical data and I would expect the orders to be submitted and then a rejection received with realtime.

    * Is the behavior the same in backtest as in real time?
    These cases will be different.

    In order to give a clear path to troubleshoot, I suggest:

    We would want to make sure with prints that the order submission method is reached, and then after, that we would check the log tab of the Control Center and check Trace Orders for any hints.

    TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm

    It is possible that the while processing historical data, virtual bars constructed from minute data for your fill series are creating virtual bars that would not allow the order to fill.

    Example case: https://ninjatrader.com/support/foru...82#post1104682

    Understanding Historical Fill Processing - https://ninjatrader.com/support/help...lFillAlgorithm

    If the above does not answer why the order is ignored, please try to reproduce the same order submission on the same bar in a separate strategy, so you could share that test strategy here and we could test the same on our end.

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Jimmyk, 01-26-2018, 05:19 AM
    6 responses
    835 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,291 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    10 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    62 views
    0 likes
    Last Post halgo_boulder  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    9 views
    0 likes
    Last Post Option Whisperer  
    Working...
    X