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

Is there no way to backtest with OnMarketData() ?

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

    Is there no way to backtest with OnMarketData() ?

    It seems the docs say that this won't fire on historical data for backtesting. Doesn't that sort of making difficult to test a strategy that uses this granular level of tick data? Am I missing something on how to go about this?

    Thanks.

    #2
    OnMarketData() will not be useful in backtesting. To go on tick granularity you need to forward test with Market Replay or simulation live.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Josh View Post
      OnMarketData() will not be useful in backtesting. To go on tick granularity you need to forward test with Market Replay or simulation live.
      I don't understand. What method do I want to override in this case? Also I am using data that I recorded with my test MB Trading account. So what is the difference between backtesting and forward testing with Market Replay? Is that not the same thing?

      Comment


        #4
        Backtesting is not the same as forward testing. Forward testing with Market Replay allows you to most accurately simulate the data as it would come in if it were live. Backtesting just takes a set of data and calculates based on already predisposed OHLC values. In realtime you would never know the HLC of a bar while the bar is in progress.

        You use whatever method you want. You just don't run Strategy Analyzer. You run Market Replay or run it live if you want OnMarketData() to work. If backtesting is what you want. You cannot get tick granularity. That is just not what backtesting does unless you want to add a 1tick series to your strategy, but even then it will not simulate it as well as a Market Replay does.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Josh View Post
          Backtesting is not the same as forward testing. Forward testing with Market Replay allows you to most accurately simulate the data as it would come in if it were live. Backtesting just takes a set of data and calculates based on already predisposed OHLC values. In realtime you would never know the HLC of a bar while the bar is in progress.

          You use whatever method you want. You just don't run Strategy Analyzer. You run Market Replay or run it live if you want OnMarketData() to work. If backtesting is what you want. You cannot get tick granularity. That is just not what backtesting does unless you want to add a 1tick series to your strategy, but even then it will not simulate it as well as a Market Replay does.
          So when I open up a new chart and format the data range to go back 2 days, and I have market data recording, what is that? Market replay or backtesting? I guess I am not clear because I am not specifically telling it to do either.

          Comment


            #6
            Market Replay is its own thing. If you open a chart and it populates with old data that is backtesting. Market Replay is an actual replay of the market as recorded by NinjaTrader. You can access your Market Replay as a connection. Just like how you would connect to your brokerage/data provider accounts.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh as always, very helpful. Can't believe I missed that, that explains why the timestamps on each data item are the same when I do a backtest

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Rapine Heihei, Today, 08:19 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 08:25 PM
              0 responses
              6 views
              0 likes
              Last Post Rapine Heihei  
              Started by f.saeidi, Today, 08:01 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 07:51 PM
              0 responses
              8 views
              0 likes
              Last Post Rapine Heihei  
              Started by frslvr, 04-11-2024, 07:26 AM
              5 responses
              98 views
              1 like
              Last Post caryc123  
              Working...
              X