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
Comment