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

Multi-Timeseries bug, or expected behavior, in Backtest?

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

    Multi-Timeseries bug, or expected behavior, in Backtest?

    I have a multi-timeseries strategy as follows:

    BarsInProgress = 0 -> Range bars
    BarsInProgress = 1 -> 15-second bars
    CalculateOnBarClose = true

    The strategy signal is generated in BIP=0 timeseries, and triggers a market order entry in BIP=1 timeseries.

    In Backtest let’s say a signal occurs at end of Range Bar (BIP=0) that closes at 12:00:05.

    The 15-second bar (BIP=1) that “overlaps” with the BIP=0 signal bar is the 15-second bar that started at 12:00:00 and ends at 12:00:15.

    What surprises me is that in backtest, the market order appears to fill at the opening price of this 15-second bar, i.e. the signal at 12:00:05 results in a fill at a price that occurred at 12:00:00 …

    … rather than say the closing price.

    So it seems to fill at a “liberal” price, rather than a conservative one.

    Is this behavior as expected? Or a bug?
    Last edited by AnotherTrader; 10-04-2012, 10:07 AM.

    #2
    Hello AnotherTrader,

    Depending on how your strategy is code this would be expected as at 12:00:05 the BIP=1 would still be at the 12:00:00 because when backtesting CalculateOnBarClose is always going to be set to true.

    Please note that when backtesting Renko bar types it can return results that would not reflect in a real-time market environment. More information about this can be found in the following thread.
    http://www.ninjatrader.com/support/f...ad.php?t=49420

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3


      Hi JC,

      I've attached a pic showing what I believe to be a problem in the backtesting engine (unless you detect a config issue).

      I have a strategy running over the ES 09-15 in combination with another instrument added in its Initialize() function, as well as a SMA, with:

      Add("AAPL", PeriodType.Day, 1);
      Add(SMA(sma_value));


      Things seem to work when doing backtesting, however there might be a problem when I try to optimize over 3 variables.
      I get 10 Optimized results, each with at least 1 trade or more, nonetheless, by clicking any from the optimized results (different than the first one), I don't see its component trades.

      Even for the first optimized result, if I click on it and then go on the "Chart" section, there is a discrepency: the chart and orders section shows 6 trades as opposed to the optimized upper view where we can see the "Total # of trades" is 3 (picture NT - Backtestin result shows 3 trades but Chart shows 6.PNG attached).

      Have you seen this before?

      Comment


        #4



        Added the picture ...

        Comment


          #5
          Hello,

          Thank you for the question.

          I am unsure this is related to this original thread, what you are experiencing may be a cache issue or possible something else.

          Can you email our platform support @ ninjatrader.com with this question and provide a link to this thread post?

          We can further troubleshoot through email to further see what is happening.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            Hi Jesse,

            It's not a cache issue - it's pretty consistent, and it's related to having multiple instruments into your optimization (not backtesting).
            I forwarded it to support. Thanks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by maybeimnotrader, Yesterday, 05:46 PM
            3 responses
            23 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            32 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            7 responses
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            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
            22 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X