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

Tick replay vs high resolution

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

    Tick replay vs high resolution

    SO I've read a bunch of posts on these forums about the difference and I'm still confused. The pics below show two backtests for the same strategy on /CL. 2 indicators. No optimizing. From what I've gleaned (and I guess misunderstood) there is no difference between checking the High Resolution on a 1 Tick basis, or using the Tick replay and programmatically passing the entry/exit to an additional dataseries at the 1 tick level. But apparently there is as these two tests demonstrate? Could someone please help me understand the difference? Many thanks.

    #2
    Hello markdshark,

    TickReplay and High order fill resolution are two totally different concepts. Tick replay allows OnMarketData to be called historically so you can have an estimate of the ask/bid events at the time of the last events. High order fill resolution uses a secondary more granular series for fills. Tick replay has nothing to do with fill resolution so it won't help to provide any further accuracy in backtesting and generally should not be used unless you have tick replay specific logic in your script. The only reason to use tick replay would be if you have logic that requires OnMarketData to be used historically, that would enable that type of logic to be used.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Is there a difference between using High order with a Tick of 1 vs adding this sort of stuff to the code?

      in this section---> if (State == State.Configure)
      {
      AddDataSeries(Data.BarsPeriodType.Tick, 1);​

      And later in onBarUpdate() this:
      EnterLong(1,Convert.ToInt32(DefaultQuantity), @"LE");​

      Comment


        #4
        Hello markdshark,

        Yes, High order fill resolution only affects fills. AddDataSeries also calls OnBarUpdate at that frequency which affects your logic.

        If using AddDataSeries you would need to use a condition to replicate what the fill resolution is doing:

        Code:
        if(BarsInProgress == 0)
        {
             EnterLong(1,Convert.ToInt32(DefaultQuantity), @"LE");​  // logic run at interval of primary series, submitted to secondary for fills
        }
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thank you. I think I'm nearing understanding but not quite there yet. Could you please elaborate on why you used if(BarsInProgress == 0) there? Am I understanding correctly that simply having EnterLong(1,Convert.ToInt32(DefaultQuantity), @"LE"); in onBarUpdate() section without something additional (besides addData...) is missing a key bit of functionality? Would it be possible to elaborate with a simple script that shows the difference?

          Is it nothing more than wrapping the entry placed in onBarUpdate with the if(BarsInProgress == 0) condition? Or do you add your own logic to the if BarsInProgress==0 (like say and MA1 crosses MA2 or whatever)

          Read a bit more and I think I have it. So BarsInProgress returns the index of the series. If say my primary series is the 1000 tick and my secondary series is to enter on the 1 tick, I'd have my logic calculated OnEachTick of the primary series and if BarsInProgress==0 (the 1000 tick), then enterLong(1, etc...) on the 1 tick chart. Correct?

          And conversely if I do not guard with BarsInProgress==0 then conditions like (if Ma[0] > ma[1] or whatever would get checked in the onBarUpdate section on the bars of each of my series.

          Is there a difference between Close and Closes[0]?

          And lastly... I already have a guard at the head of the code: if (BarsInProgress != 0) return; it would seem I do not need​ if BarsInProgress ==0

          However my higher order indicator for the 4 hour bar series is only loaded once in the State.DataLoaded section. Do I need to be refreshing that in the onBarUpdate section?
          Last edited by markdshark; 09-16-2022, 11:37 AM.

          Comment


            #6
            After more reading and thinking I believe I have all the above sorted out in my head except for this one remaining bit of confusion:

            If I instantiate an indicator in State.DataLoaded, does it automatically get updated in the future or do I need to be recalling it somewhere in onBarUpdate() or onMarketUpdate() because State.DataLoaded only happens once so how does it get future values?

            Comment


              #7
              Hello markdshark,

              You would need to call the indicator to get its values so when you call its variable from OnBarUpdate that is executing the indicator as well. If you are using AddChartIndicator that will also run the indicator but just for visual purposes.
              JesseNinjaTrader Customer Service

              Comment


                #8
                thanks much!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by burtoninlondon, Today, 12:38 AM
                0 responses
                9 views
                0 likes
                Last Post burtoninlondon  
                Started by AaronKoRn, Yesterday, 09:49 PM
                0 responses
                14 views
                0 likes
                Last Post AaronKoRn  
                Started by carnitron, Yesterday, 08:42 PM
                0 responses
                11 views
                0 likes
                Last Post carnitron  
                Started by strategist007, Yesterday, 07:51 PM
                0 responses
                13 views
                0 likes
                Last Post strategist007  
                Started by StockTrader88, 03-06-2021, 08:58 AM
                44 responses
                3,983 views
                3 likes
                Last Post jhudas88  
                Working...
                X