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

Any advantage to Tick Replay for Calculate.OnBarClose?

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

    Any advantage to Tick Replay for Calculate.OnBarClose?

    I have a strategy I converted from TOS that uses 5 min bars. I've read several posts that say there is simply no advantage to using Tick Replay for back testing strategies that calculate OnBarClose. This makes perfect sense to me as all calculations should just get processed at the bar close. However, I notice huge differences in the strategy when Tick Replay is enabled vs a simple backtest. The strategy does look at Highs and Lows for preceding bars, but these values should be available on both standard historical or tick replay data.

    I did add the ATR indicator and my own Donchian Channel indicator to the strategy and their values are used to determine trades. Could these be the reason for the large difference in results?
    At the end of the day, I'm thinking this logic only gets called every 5 min regardless of the data granularity. So why the huge difference in results?

    #2
    Hello fmcap,

    Thank you for your reply.

    We wouldn't expect differences with Tick Replay On with Calculate set to OnBarClose unless the strategy was using OnMarketData for something. Does the strategy use OnMarketData?

    If not, I would test with the Sample MA Crossover that's built into NinjaTrader over the same time period and instrument you're testing this strategy on. We've tested this on our end and it should come up with the same result whether or not Tick Replay is enabled. If you get different results with this, that would indicate a data issue.

    If they come up with different results, you'd want to delete the historical data, clear your cache, and redownload the necessary data before testing again. If this is the case, please delete your historical data using the instructions provided at the following page of the NinjaTrader Help Guide:

    Removing Historical Data
    • Once the data has been deleted close NinjaTrader. Open the Documents\NinjaTrader 8\db\cache folder. Select all files then right mouse click and select “delete.”
    • Open NinjaTrader and connect to your data provider.
    • Download minute and tick data for the entire time frame using the Historical data window (Tools > Historical Data > Load)
    • Rerun backtests for Sample MA Crossover, over the same time period, one with Tick Replay and one without
    • If these match, run backtests on your strategy again.

    Please let me know if this resolves this item.


    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      regarding the headline of this thread, is there any advantage of OnBarUpdate or OnPriceChange calculation for Tick Replay indicators that do use OnMarketData?
      Because in the end it has to process all ticks, right. So whether it does it at each tick or just once per bar should be the same. But I am not sure about all the rest indicator code like graphic and calculations.

      Greetings

      Comment


        #4
        Hello seykool,

        Thank you for your reply.

        It would depend on what the indicator does whether you'd want to run it OnBarUpdate or OnPriceChange/OnEachTick. I would advise taking a look at this section of our help guide on working with Tick Replay to best understand what occurs when Tick Replay is used:



        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hi Kate,

          thanks for your reply and the link.

          Well, depending on whether OnPriceChange saves computing resources, I would want to have the indicator on OnPriceChange or on OnBarClose. If it wouldn't save resources I would just set it to OnEachTick.
          Therefore the question.

          The indicator gets each tick OnMarketData like the Buy sell Volume indicator. Then it draws some plots derived from those values.

          Greetings

          Comment


            #6
            Hello seycool,

            Thank you for your reply.

            The buy sell volume indicator specifically would require OnEachTick to function properly in real time, and would need tick replay turned on to function on historical data - if you try to run it OnBarUpdate you'll get a message stating it's expecting OnEachTick.

            Indicators that rely on OnMarketData would generally need to be run in this way.

            Please let us know if we may be of further assistance to you.

            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Thank you Kate. I will set them all on OnEachTick.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              3 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              214 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              545 views
              0 likes
              Last Post PaulMohn  
              Started by GLFX005, Today, 03:23 AM
              0 responses
              3 views
              0 likes
              Last Post GLFX005
              by GLFX005
               
              Working...
              X