Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tick Replay or Order Fill resolution?

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

    Tick Replay or Order Fill resolution?

    What gives you a more accurate backtest: Tick Replay or Order Fill resolution?

    #2
    Hello AdeptistJune,

    TickReplay would allow OnBarUpdate to update for OneEachTick or OnPriceChange historically but does not fill orders intra-bar bar. Order fill resolution high would give more accurate fill prices, but cannot be used with TickReplay and would require adding 1-tick intra-bar granularity.

    Please see the post below on intra-bar granularity with details.
    https://ninjatrader.com/support/foru...ive#post773377
    Last edited by NinjaTrader_ChelseaB; 11-17-2021, 08:08 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      In my strategy, I use Calcutate.OneachTick and I use targets and stops. My primary bar is the 6 minute NQ chart. I am doing my best to achieve granularity. I used the sample code "SampleIntrabarBacktest" but since I'm using set targets and stops I have no idea how to apply the sample code properly. I ran the code on sim in the live market yesterday, it did $1600 and 17 trades. I then used market replay and the results were different, $500 and 22 trades.

      I am so lost what to do. What step should I complete first to build a system an accurate back test? Where should I start first?

      Thanks.

      Comment


        #4
        Hello AdeptistJune,

        Add a 1 tick series. Submit orders to BarsInProgress 1.
        EnterLong(int barsInProgressIndex, int quantity, string signalName)
        EnterLong(1, 1, "myEntry");

        Likely, you would also want to have the logic evaluate on the primary series.
        If (BarsInProgress != 0 || CurrentBar < BarsRequiredToTrade)
        return;
        Last edited by NinjaTrader_ChelseaB; 03-13-2022, 11:52 PM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Good morning,

          While the code gives me highest order resolution for entries, it does not give my set stops and set targets the highest order resolution. How would I write the code to give me the highest order resolution for my set targets and set stops? Thanks.

          Comment


            #6
            Hello AdeptistJune,

            Set methods will use the OHLC values of the data series applied unless the strategy was enabled with High Order Fill Resolution.

            If you have unlocked the code and are submitting orders to a single tick data series, you can then use Exit methods in stead of the Set methods for your targets and stops.

            An example that demonstrates using Exit methods for stops and targets can be found below. (Please note that the example does not submit those orders to the single tick data series.)


            Comment


              #7
              I dont understand what you're implying. I have setprofittarget set to 40 ticks. i trade it on a six minute chart. if 40 ticks are hit before the next six minutes the the system exits the trade. but in the backtest the time of exit is not what would have happened live.

              Comment


                #8
                Good Morning,

                I attached the screenshots of what I was explaining about order fill resolution with SetProfitTarget(@"Set1 Long", CalculationMode.Ticks, TargetProfit);
                SetStopLoss(@"Set1 Long", CalculationMode.Ticks, StopLoss, false);

                Is it possible to use the SetProfitTarget and SetStopLoss with the Added 1 Tick Series so that I can get a more accurate fill on my exits?

                Thanks.
                Attached Files

                Comment


                  #9
                  Hello AdeptistJune,

                  There is no intrabar movement with historical processing, and the OHLC of the data series are used to fill orders. If you are not using High Order Fill Resolution, or if you are not submitting orders to a single tick data series, the primary data series OHLC values would be used.

                  If you are looking to achieve accurate fill levels in a script that adds a 1 tick data series, it would be advised to use Exit methods instead of Set methods, because you can direct the Exit order to the single tick data series.

                  Comment


                    #10
                    Hello Chelsea,

                    When you said,

                    Add a 1 tick series. Submit orders to BarsInProgress 1.
                    EnterLong(int barsInProgressIndex, int quantity, string signalName)
                    EnterLong(1, 1, "myEntry");

                    Likely, you would also want to have the logic evaluate on the primary series.
                    If (BarsInProgress != 0 || CurrentBar > BarsRequiredToTrade)
                    return;

                    I added this code to the script and I'm still not getting accurate intra-bar granularity.

                    Can there be something I'm over looking?

                    Comment


                      #11
                      Hello AdeptistJune,

                      This would be to ensure that the added series has at least 1 bar (tick). When adding series, these may have different amounts of bars. Its important to check that the series being used has at least one bar.

                      What do you mean by in-accurate intra-bar granularity?

                      Are you writing the tick data to file and seeing that the orders are not filling at the tick price of the 1 tick series?
                      Citizens of the NinjaTrader Community, A common question we hear from clients is 'why are results from backtest different from real-time or from market replay?'. Live orders are filled on an exchange with a trading partner on an agreed upon price based on market dynamics. Backtest orders are not using these market dynamics.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      62 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      134 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      75 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      45 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      50 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X