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

Backtesting intrabar in Strategy Analyzer

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

    Backtesting intrabar in Strategy Analyzer

    I have a custom strategy designed to trade intrabar. I use a custom bid/ask delta indicator (3 min NQ) and a 10 minute volume indicator so multiple time frames. My goal is to have work accurately in Strategy Analyzer. When I run a backtest with Tick Replay and Load Saved Data enabled, with Order Fill Resolution set to 1 tick, trades enter on the correct intrabar. I’ve been told in the past by NT support that Tick Replay was not designed for backtesting, so I am looking for an alternative since have noticed it misses some trades when backtesting. When I turn Tick Replay and Load Saved Data off, trades enter a bar late. I'm told the workaround to backtest with high resolution (1 tick) and enter trades intrabar accurately (without using Tick Replay), would be to change default chart to a 1 tick chart and change the trading timeframe (3 min) to secondary chart series.

    Is this a viable alternative and how difficult to change logic for an existing strategy that is quite long in code with several indicators and timeframes?

    Is Order Fill Resolution not designed for this purpose (closes a bar late when set to 1 tick)?

    #2
    Hello connorgrant5,

    Thank you for your note.

    TickReplay can be used to allow indicators to trigger On each tick or On price change historically.
    TickReplay cannot be used for accuracy in fill prices.

    Below is a link to a forum post where I have detailed this.


    Orders submitted to a 1 tick added series for accurate prices in combination with TickReplay for indicators will give as close to realistic results as possible (with accuracy of up to 1 tick).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Is the issue below resolved in current build? Also, does last paragraph below work with multiple timeframes?

      Currently, at this time, there is a known issue (tracked with ID# NTEIGHT-10782) where the High Fill Order Resolution and TickReplay cannot be used together. These work great when used on their own, however, when used together a complication arises that prevents the script from processing. Our developers are working hard to have this corrected in an upcoming build of NinjaTrader 8.

      In the meantime, if it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself with AddDataSeries() for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically and/or have IsFirstTickOfBar work correctly in historical data.

      Comment


        #4
        Hello connorgrant5,

        NTEIGHT-10782 has been closed as a technical limitation for using Tick Replay in combination with High Order Fill Resolution. Need for this functionality is being tracked in SFT-1002 and I have added a vote on your behalf.

        Feature requests and Enhancement requests are implemented based on client feedback, discretion from Product Management, feasibility, and the ongoing tasks of the Development team. As such, we cannot offer an ETA or promise of fulfillment.

        In the meantime, if it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself with AddDataSeries() for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically and/or have IsFirstTickOfBar work correctly in historical data.
        Yes, you can use Tick Replay with a strategy that submits orders to a single tick data series. Your understanding is correct. Chelsea's linked post goes into detail on this. Please also see the Backtesting with intrabar granularity example linked there as well.

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Does below work with multiple timeframes in a strategy?

          Adding intra-bar granularity to a script in the code itself with AddDataSeries() for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically and/or have IsFirstTickOfBar work correctly in historical data.

          Comment


            #6
            Hello connorgrant5,

            Yes, this will work with a multi time frame strategy. We are essentially creating a multi time frame strategy, but would be submitting orders to the added single tick data series without processing OnBarUpdate for the single tick data series' updates.

            Let us know if you have any additional questions.
            JimNinjaTrader Customer Service

            Comment


              #7
              Where can I locate ID# NTEIGHT-10782 or SFT-1002?

              Comment


                #8
                Hello connorgrant5,

                You can inquire with us regarding these ID's. NTEIGHT ID numbers will be listed in the Release Notes page of the help guide when a release contains that change/feature/fix.

                Feature/Enhancement ID's (SFT tickets) may be implemented differently than the verbatim request, so you may review the Release Notes page for a description of the change to see if it satisfies the functionality you were looking for with your request.

                Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
                JimNinjaTrader Customer Service

                Comment


                  #9
                  My coder said the workaround for the technical limitation for using Tick Replay in combination with High Order Fill Resolution shown below is exactly what high fill order resolution is already doing... using adddataseries. Is he missing what would change per below?

                  Per Chelsea at support: "In the meantime, if it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself with AddDataSeries() for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically and/or have IsFirstTickOfBar work correctly in historical data."

                  Comment


                    #10
                    Hello connorgrant5,

                    High Order Fill Resolution essentially does the same thing as submitting orders to a finer data series. The same concept is used to get order fills more consistent with actual market movement, but High Order Fill Resolution takes an approach that is not compatible with Tick Replay.
                    Last edited by NinjaTrader_Jim; 12-20-2019, 02:14 PM.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      To clarify, the code added is exactly the same and if so why would there not be the same issue?

                      Comment


                        #12
                        Hello connorgrant5,

                        No, the code is not exactly the same. High Order Fill Resolution takes a different approach that is not compatible with Tick Replay. (Internally High Order Fill Resolution is based off of Tick Replay functionality rather than a Multi Time Frame approach.) Submitting orders to a single tick data series accomplishes the same, but it is compatible with Tick Replay.

                        Please let me know if I can be of further assistance.
                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Has the issue below from 2019 been resolved?

                          12-19-2019, 04:31 PM
                          Currently, at this time, there is a known issue (tracked with ID# NTEIGHT-10782) where the High Fill Order Resolution and TickReplay cannot be used together. These work great when used on their own, however, when used together a complication arises that prevents the script from processing. Our developers are working hard to have this corrected in an upcoming build of NinjaTrader 8.

                          In the meantime, if it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself with AddDataSeries() for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically and/or have IsFirstTickOfBar work correctly in historical data.

                          Comment


                            #14
                            Hello connorgrant5,

                            That issue was left due to the complexity of the Tick Replay engine and the risk that is carried with modifying it.

                            Yes, you may add a single tick data series and submit orders to that data series to accomplish the same as High Order Fill Resolution. (This can be done with Tick Replay.) Since we can add a single tick data series and submit orders to that data series to get the result we are looking for, a workaround already exists and is what we recommend.

                            The Tick Replay engine may be enhanced in a major update to NinjaTrader, like a version 8.5 or a version 9, but we cannot offer any sort of ETA there, or promise of fulfilment.

                            When the issue was left, SFT-1002 was opened to track impact for consideration in a major update. Your vote is tacked there.

                            Let us know if you have any questions.
                            JimNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by maybeimnotrader, Yesterday, 05:46 PM
                            4 responses
                            23 views
                            0 likes
                            Last Post maybeimnotrader  
                            Started by frankthearm, Today, 09:08 AM
                            6 responses
                            25 views
                            0 likes
                            Last Post frankthearm  
                            Started by adeelshahzad, Today, 03:54 AM
                            5 responses
                            33 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by stafe, 04-15-2024, 08:34 PM
                            7 responses
                            32 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by merzo, 06-25-2023, 02:19 AM
                            10 responses
                            824 views
                            1 like
                            Last Post NinjaTrader_ChristopherJ  
                            Working...
                            X