Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest bug

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

    Backtest bug

    I am backtesting a strategy with LongLimit orders and ExitLongLimit orders intraday. When I added a lower timeframe on my strategy, (lower than the 60 min chart I am using) the backtest threw unrealistic, very misleading results.
    I think the problem could probably lie in the method Time[0], Times[1][0], LimitOrders or how Ninjatrader is dealing with methods on multi-timeframe strategies...

    Anyway attached the results. On the same hour, minute and second the strategy buys and sells, the YM goes up 44 points and I make good $221 per trade. Repeats this so many times I end up with $10k on that very second...

    I don't know what's wrong but the strategy compiles Ok and the log doesn't throw any messages...
    Attached Files

    #2
    Hi carlosavellan,

    From what is in the screenshot here are my thoughts.

    My assumption is that you are triggering the entry on the smaller time frame using the data of the higher time frame. For the higher time frame bar the conditions are not changing and the trigger to enter exit the trade is being called over and over on each smaller time frame bar.

    The logic should be checked by adding prints that print all of the variables you are checking for entry. If the conditions are true on each print for the smaller time frame, that will confirm this is the issue.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Daily Strategy plotted in 60-min chart

      Chelsea,
      I have another question now. I am backtesting a daily strategy with daily data. My positions last less than a day, I enter and exit my position mostly within a given day. The results, orders and trades seem to make sense.
      When I backtest this Daily strategy on a 60 min bars, results are the same (it is consistent, I am using BarsInProgress==1 and BarsArray[1] to pull the information).

      However, in the 60-min chart Ninjatrader plots my Entry and Exit point both in the "Session exit??".
      Please see attached. and thanks!
      Attached Files

      Comment


        #4
        Hello carlosavellan,

        Its possible both the entry and exit are within that last 60 minute bar.

        I recommend you print the order.Time in OnOrderUpdate to see what time the order is being filled.

        For example:

        Print(order.Time+" - "+order.ToString());
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          For some reason all orders (or the winning ones at least) are getting filled at 11 PM. Then, all executions are occurring at 11 PM the next day... I don't get it.
          Please see attached.
          Attached Files

          Comment


            #6
            Hello carlosavellan,

            Are you running this on a 60 minute series?

            Where are the prints in your output?

            Are the entries at the improper time? Are the exits at the improper time?

            Have you added prints to your code to see the values of the variables in the conditions that submit orders?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Inconsistency between charts (day and 60-min)

              I think I found in part the issue. Please see attached images of CL 9/30/14.

              - The Daily chart shows a winning trade going long at $92.24.
              - The 60-min chart shows a losing trade going long at $92.24.

              Looking at the 60-min chart it is evident that once the price reaches $92.24, it does not go up . Then,

              1) Why is NT showing the trade as a winner in the Daily chart?
              2) What information does NT use to come up with the Day Bar?

              Regards,
              Attached Files

              Comment


                #8
                Hi carlosavellan,

                What kind of orders are these?

                What price where these two orders submitted at? (not filled at)

                What time were the orders placed?

                What time did the orders fill?
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by nleitman, Yesterday, 11:46 AM
                16 responses
                43 views
                0 likes
                Last Post nleitman  
                Started by MSerag, Yesterday, 11:52 PM
                3 responses
                23 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by dcriador, Yesterday, 01:43 AM
                6 responses
                29 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by James650, Today, 08:25 AM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by Rogers101, 05-05-2024, 11:30 AM
                14 responses
                41 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X