Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Errors in backtesting

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

    Errors in backtesting

    When I run a backtesting for a strategy I have detected some errors in specific situations.For example, if there is a bar which close above its open and my strategy have openned long postion by "stop order", the backtesting registers this operation like loser, but isn't correct because the bar price doesn't back to my level stop. How can I configurate the backtesting for solve this mistakes in the backtesting?

    Thanks in advance.

    #2
    Hello soyjesus,

    Unfortunately I do not follow. Where exactly in the Strategy Analyzer does it list the order as a loser? Could you perhaps post a screenshot?
    JasonNinjaTrader Customer Service

    Comment


      #3
      Hello Jason,

      This is an example in which the strategy has 5 ticks of profit target and the same for the stop loss. You can see that the next bar to the entry we can target the profit, but the backtesting register that the stop loss have been reached.

      Comment


        #4
        The 11:15 bar includes a price of 1.3099, so the position was closed by your stop loss before the market traded at 1.3109 as per the next bar.
        JasonNinjaTrader Customer Service

        Comment


          #5
          Jason, in real-time the strategy enter long at 1.3104 but the stop is not trigered because the price at 1.3099 was reached before (at the beginning of this bar). So his operation was finalized with 5 ticks of benefit but the backtesting say that was 5 ticks of loss.

          Comment


            #6
            Unfortunately backtests only use OHLC data per bar - intra day data is unknown. Such discrepancies can be as expected when comparing a backtest and a real-time test. Please see the link below for more information.


            Getting Filled on an Order

            • During a backtest you can select conservative or liberal fill algorithms which will produce different results. Fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest.

            • 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.

            • During real-time live brokerage trading, orders are filled according to market dynamics.

            As you can see, there are three distinctly different models for how and when an order may be filled. This is why you may see orders NOT fill in real-time that you may otherwise expect to see filled based on your backtesting results.
            JasonNinjaTrader Customer Service

            Comment


              #7
              Ok Jason, thank you very much for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by stafe, 04-15-2024, 08:34 PM
              7 responses
              31 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by adeelshahzad, Today, 03:54 AM
              4 responses
              30 views
              0 likes
              Last Post adeelshahzad  
              Started by merzo, 06-25-2023, 02:19 AM
              10 responses
              823 views
              1 like
              Last Post NinjaTrader_ChristopherJ  
              Started by frankthearm, Today, 09:08 AM
              5 responses
              17 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              43 views
              0 likes
              Last Post jeronymite  
              Working...
              X