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

Confused about historical fill processing methods for limit orders

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

    Confused about historical fill processing methods for limit orders

    I have read through the previous posts about this issue, but am still none the wiser, so I thought I would try and have another go at understanding it here...

    I want to backtest a very simple strategy:

    it runs off 480 min. bars, so there are exactly three bars per session: lets call them Bar0, Bar1, and Bar2. I want to evaluate some conditions on the close of thie first bar of the session,bar0, and enter a STOPMARKET order, either long or short, depending on the conditions. I set the stop to be above the market for LONG, and below for SHORT. I want this order to either fill during the following bar, (Bar1), or cancel itself if not filled at the bar close. From what I understand, this is normal default behaviour for limit orders in NT, which is great. However, when I run this strategy on a chart with historical data, the limit orders are submitted but immediately cancelled!!! Order fill resolution was set to NORMAL. From the documentation found here, I thought that NT would at least make an attempt to fill the order using the three virtual bar logic described in detail, but no. I then try the HIGH setting, with Minute bars for granuar infill, but the result is the same. The strategy is set to calculate OnBarClose. The strategy works fine when I use market orders, but the orders are simply entered on the open of the following bar, not at my desired stops.

    In an effort to simplify, I dont want to have to add in a secondary data series and deal with BarsInProgess logic, but it appears there's no getting around it... unless I'm missing something obvious (quite possible)???

    Hoping someone can explain the proper use of the HIGH order fill resolution setting, and perhaps provide a simple example to demonstrate the concept?

    #2
    Hello ours_solaire,

    Thanks for your inquiry.

    I'm working on an example and demonstration to address this. I'll update this post once these are prepared.

    Thanks in advance for your patience.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks Jim - Looking forward to seeing it!

      Comment


        #4
        Hello ours_solaire,

        I have put together an example script to demonstrate Tick Replay, High Order Fill Resolution and IsLiveUntilCancelled orders. I am seeing some inconsistencies when using Standard Fill Resolution and Tick Replay which look consistent with your inquiry. The orders appear to expire and/or cancel before the primary data series fills them.

        EDIT: The issue has been summarized that order does not last until the end of the bar and is being tracked with ticket ID: NTEIGHT-12828. This ticket ID can be noted in the Release Notes page of the version of NinjaTrader that includes the fix. This page can be found here: https://ninjatrader.com/support/help...ease_notes.htm

        For reference, the demonstrating script is attached.

        Thanks for bringing this matter to light.
        Attached Files
        Last edited by NinjaTrader_Jim; 05-16-2018, 02:44 PM.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim - i dont see this is solved? - can you tell me if the problem described above is solved now?

          And also - does this mean that i can not backtest historical data- with "isLiveUntilCancelled"?

          Thanks
          Karsten

          Comment


            #6
            Hello Karsten,

            Thank you for your note.

            I searched through some previous release notes and was unable to find info about NTEIGHT-12828, which was created in 2018. That said, you should be able to backtest on historical data with isLiveUntilCancelled set to true. Have you been experiencing any issues with this? If so, please provide additional details.

            There is a thorough explanation of backtesting, the order fill resolution, intra-bar granularity, and Tick Replay in the following thread:


            Please let me know if I may be of further assistance.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Hi Emily

              Im trying to do the same as ours_solaire​ ask originally - to have script enter limit/Mit order - and use the is live until cancelled.
              It is ok that i have an extra time-series - but the tick resolution/tick replay is too high for this setup sinse i backtest on minute data back to 2005.

              So - im interested in seeing a proof/simple script that shows that the isliveuntil canncled - is actually working in historical data?
              I downloaded the script above - but as it was descibed it did not work - and is not updated/fixed - and uuses tick data instead of minute data for extra time series.

              You write "you should be able to backtest with historical data - with isliveuntilcancelled set to true." - have you tried this - and can you show any example where this is actually working?

              Best regards
              Karsten

              Comment


                #8
                Hello Karsten,

                Thank you for your reply.

                I have created the attached strategy to demonstrate. It is set up to only submit an entry once, and it is an EnterLongLimit order with isLiveUntilCancelled set to true. If the order is not filled within 5 bars of being submitted, the strategy calls CancelOrder(). You can test this in the Strategy Analyzer, and you may also comment out lines 83-87 that result in the order being canceled, to see that the order will remain live until canceled.

                Please review the attachment and let me know if you have any additional questions or concerns.
                Attached Files
                Emily C.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jclose, Today, 09:37 PM
                0 responses
                4 views
                0 likes
                Last Post jclose
                by jclose
                 
                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                10 responses
                1,413 views
                0 likes
                Last Post Traderontheroad  
                Started by firefoxforum12, Today, 08:53 PM
                0 responses
                10 views
                0 likes
                Last Post firefoxforum12  
                Started by stafe, Today, 08:34 PM
                0 responses
                10 views
                0 likes
                Last Post stafe
                by stafe
                 
                Started by sastrades, 01-31-2024, 10:19 PM
                11 responses
                169 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X