Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Multi time frame issues

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

    Strategy Analyzer Multi time frame issues

    Hi,

    I am trying to port an NT 7 strategy to NT 8. This strategy runs multiple timeframes. To ensure that I ported correctly, I compared the results from NT7 and NT8, and noticed that NT8 was increasing the number of trades significantly. So I drilled down into NT8 and then started adding Print statements to the indicators being called in each Data Series to see how they were being processed. To provide some back ground, and to make this easy to explain, my set up is as follows:

    Calculate = Calculate.OnBarClose
    IsInstantiatedOnEachOptimizationIteration = false

    Primary Data Series is set to 100 tick (underlying symbol/strategy base)
    Secondary Data Series is set to 200 ticks
    Tertiary Data Series is set to 400 ticks

    The output below shows how the indicators are processed. The same indicator is processed by the secondary and tertiary data series. My expectations were that for every two "steps" of the secondary data series, the third data series would be processed once. Instead I got something completely different and to me, looks very wrong:

    Processing bar: BarPeriod: 200 Tick; Current Bar: 1
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2
    Processing bar: BarPeriod: 200 Tick; Current Bar: 3
    Processing bar: BarPeriod: 200 Tick; Current Bar: 4
    Processing bar: BarPeriod: 200 Tick; Current Bar: 5
    Processing bar: BarPeriod: 200 Tick; Current Bar: 6
    Processing bar: BarPeriod: 200 Tick; Current Bar: 7
    Processing bar: BarPeriod: 200 Tick; Current Bar: 8
    Processing bar: BarPeriod: 200 Tick; Current Bar: 9
    Processing bar: BarPeriod: 200 Tick; Current Bar: 10
    Processing bar: BarPeriod: 200 Tick; Current Bar: 11
    Processing bar: BarPeriod: 200 Tick; Current Bar: 12
    Processing bar: BarPeriod: 200 Tick; Current Bar: 13
    Processing bar: BarPeriod: 200 Tick; Current Bar: 14
    Processing bar: BarPeriod: 200 Tick; Current Bar: 15
    Processing bar: BarPeriod: 200 Tick; Current Bar: 16
    Processing bar: BarPeriod: 400 Tick; Current Bar: 1
    Processing bar: BarPeriod: 400 Tick; Current Bar: 2
    Processing bar: BarPeriod: 400 Tick; Current Bar: 3
    Processing bar: BarPeriod: 400 Tick; Current Bar: 4
    Processing bar: BarPeriod: 400 Tick; Current Bar: 5
    Processing bar: BarPeriod: 400 Tick; Current Bar: 6
    Processing bar: BarPeriod: 400 Tick; Current Bar: 7

    The bars are not being processed in order. OK, so maybe this has something to do with the warm up period. So I then look at the end of the output (from NinjaScript Output window)

    Processing bar: BarPeriod: 200 Tick; Current Bar: 2187
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2188
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2189
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2190
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2191
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2192
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2193
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2194
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2195
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2196
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2197
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2198
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2199
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2200
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2201
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2202
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2203
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2204
    Processing bar: BarPeriod: 200 Tick; Current Bar: 2205

    As you can see, no 400 tick bars have been processed in this period. In fact, I have to go back 40 lines to find the last time a 400 tick period was executed.

    I have spent the last two days looking at this, and the more I look at it, the more confused I get. Question are:

    1. Is this an issue related to just the Strategy Analyzer? Or does real-time process getting executed in such a way?

    2. What happens to event-driving processing when used in the Strategy Analyzer? The above output quite clearly shows that the events are not being processed correctly.

    To cap it all, I then get the following message at the end of the Strategy Analyzer:

    "Error on calling 'OnBarUpdate' method on bar 1083: You are accessing an index with a value that is invalid since it is out-of-range"

    The last bar of the 400 tick period was bar 1082:

    Processing bar: BarPeriod: 400 Tick; Current Bar: 1082

    So Bar 1083 has not closed/formed. You can see from the above output that the last bar for the 200 tick series was 2173. 2173 * 200 ticks = 434600 ticks. 434600/400 = 1086.5. So how can 1083 be missing?

    I hope you can shed some light on this.

    Thanks,
    Simon

    #2
    Hello simondul,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    Do you have TickReplay enabled for this test? If so, this is a currently known item that development is looking into under the ID NTEIGHT-10795.

    Comment


      #3
      Patrick,

      For the example I posted, Tick Replay was turned off. I did try with Tick Replay but something cause it to terminate after a couple of minutes. There was no crash, the analysis just ended without posting any results. I did not investigate any further.

      For the logged bug (NTEIGHT-10795), how do I see the status and if it will be addressed in the next update?

      Thanks,
      Simon

      Comment


        #4
        Hello simondul,

        Thank you for your response.

        This would just a be a reference id for the case.

        I could not reproduce what you see on historical data in the Strategy Analyzer without TickReplay with my own script, can you provide a test script?

        For the index error on calling OnBarUpdate it would likely refer to the last bar in the Strategy Analyzer not being truly closed. Bars will not be closed unless the following bar has opened.

        Comment


          #5
          Patrick,

          I will prepare a test script this coming weekend as I am tied up through to the end of this week.

          Thanks
          Simon

          Comment


            #6
            Patrick,

            I have created a test script, but that processes everything in the expected order.

            I need to add back in components and find out what triggers the change in processing. This will take me some time...

            Thanks,
            Simon

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            32 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            4 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            19 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            6 views
            0 likes
            Last Post cre8able  
            Started by Haiasi, Today, 06:53 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X