Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Discrepancies: Real-Time vs Backtest

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

    Discrepancies: Real-Time vs Backtest

    During a backtest fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest.
    Why only OHLC? Why isn’t it possible to run a backtest on tick data?
    I think it is possible to get access to historical tick data, so why only OHLC?
    Is this (un)capability typical only of NinjaTrader?

    During simulation using real-time live market data or Market Replay, the fill algorithm is dynamic in that it uses incoming market data (both price and volume) to determine if an order should be filled or not.
    Why isn’t it possible to use volume in backtesting?
    Is there some way to accomplish this?


    You state two contradictory (at least for me) statements in the help:
    Fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest.
    and
    During backtest, strategies can ONLY be processed at the close of each bar.
    If OHLC of a bar is known during a backtest, why is that strategies can ONLY be processed at the close of each bar?

    #2
    Hello,

    Thank you for your forum post.

    This is typical of a lot of backtesting software. The reason why this is done is if all backtests ran at the tick level backtests would take a TON of computing power and would take a long time to complete.

    If your strategy needs better granularity you can use the following sample / guide to add in granularity to your backtest if it is needed. I suggest added in the highest granularity you can.

    As far as your second question strategies in NinjaTrader will calculate at the close of the bar always. In essence always running in Calculate On Bar Close mode. The reason this is occurs is that during a live run you have no way of knowing where the high or low of the bar is when the bar is forming. This information is not available during live therefor it is not available to you backtesting.

    The only thing that can be known is the bar open and the bar close. NinjaTrader is designed to calculate on the bar close and then submit and orders to the open of the next bars price. This is how NinjaTrader has chosen and believes works best for backtesting.

    Add Granularity:

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


    Let me know if I can be of further assistance.

    Comment


      #3
      Thanks for the reply.

      There is a question remained unanswered:

      Why isn’t it possible to use volume in backtesting? (if historical volume data is available)
      Is there some way to accomplish this?

      Comment


        #4
        Hello,

        Volume is possible to use in backtesting.

        VOL()[0] will work in a backtest if the volume is availiable from the data feed provider.

        Let me know if I can be of further assistance.

        Comment


          #5
          Dear Brett,

          Thanks.


          I've read the post by NinjaTrader_Josh about Granularity.

          I ask you to describe the differences to me between each method, or please ask Josh to answer this post.

          1)
          The standard method is where you only have 1 time frame, one chart,

          2)
          The ‘intrabar granularity’ method is where you have a shorter time frame to submit orders.

          One thing I don’t understand:
          “…taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building.”
          Whether you have a shorter time frame or not you have to wait until the next bar starts building, haven’t you? I think this because forming the entry condition is at the end of the bar, hence the next bar starts to form immediately after this, and you have to wait for this, whether this next bar is the same 5 min bar or a 1 min bar.

          Besides this, please describe all the differences between the two method.
          Which are the benefits and drawbacks of each method?


          Thanks.

          Comment


            #6
            Hello,

            Your correct in your understanding.

            However what you can do is add in a 1 tick chart. This is essentially the same as running on realtime data.

            I believe you have the understanding down pat. This is simply allowing you to have more data points to execute agianst.

            Let me know if you hve any more specific questions and I will answer specific questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by drewski1980, Today, 08:24 AM
            0 responses
            3 views
            0 likes
            Last Post drewski1980  
            Started by rdtdale, Yesterday, 01:02 PM
            2 responses
            16 views
            0 likes
            Last Post rdtdale
            by rdtdale
             
            Started by TradeSaber, Today, 07:18 AM
            0 responses
            7 views
            0 likes
            Last Post TradeSaber  
            Started by PaulMohn, Today, 05:00 AM
            0 responses
            10 views
            0 likes
            Last Post PaulMohn  
            Started by ZenCortexAuCost, Today, 04:24 AM
            0 responses
            6 views
            0 likes
            Last Post ZenCortexAuCost  
            Working...
            X