View Full Version : Multi-timeframe strategy skips lower timeframe bars at one point
adamus
07-02-2010, 08:54 AM
My strategy uses 60min bars and 1min bars and on one day on GBPUSD - 2010-03-09 - it doesn't execute the 1min bars.
I print out the OHLC on every bar to make debugging easier and I don't see any print() in the output for the 1min bars on this date.
What should I be looking for here? What could stop the onBarUpdate event from firing?
The only suspicious thing I see is that the price gaps down 50 points at midnight 2010-03-08.
I tested using one of the sample strategies
Ah, actually looking at the minute bars in the chart for the sample strategy, it shows no minute bars for 2010-03-09 until 22:16 (the forex session start) which accounts for the apparent gap on the chart, but the data is there in the HDM for the whole day from 00:01 to 00:00
What could this be down to?
Thanks
NinjaTrader_RyanM
07-02-2010, 09:14 AM
Hello adamus,
The strategy will execute bars for the day starting at the time defined in your session template. What results do you get when switching this to Default 24 / 7 ?
adamus
07-02-2010, 10:37 AM
Setting the Session Template to 24/7 sorts out the data on that date. But it is forex and it should be showing all the data for the day, just as the rest of the days have, and just as the rest of the instruments do.
Or was there something special about 2010-03-09? Was it a holiday? Is that recorded in NT?
NinjaTrader_RyanM
07-02-2010, 11:05 AM
NinjaTrader does not designate Holidays. I'm not sure why 3-9-10 would work differently than other days for the same instrument and session template.
Can you share the following and I'll test here:
The code you're using to print
Instrument applied
Which Data Provider you're using.
Time Zone
Session Template used
adamus
07-02-2010, 01:41 PM
It's GBPUSD
Interactive Brokers
Timezone London / Dublin
Session Template Forex (default for instrument)
string ohlc = "O[" + Open[0].ToString(getFormat(TickSize)) + "] H[" +
High[0].ToString(getFormat(TickSize)) + "] L[" +
Low[0].ToString(getFormat(TickSize)) + "] C[" +
Close[0].ToString(getFormat(TickSize)) + "]";
Print(Time[0] + " " + ohlc);
NinjaTrader_Josh
07-02-2010, 02:03 PM
adamus,
Are you saying you don't see the data being charted at all? Or are you saying the data is being charted but just not processed?
adamus
07-02-2010, 02:10 PM
The 60 mins bars (the primary timeframe) is charted and processed, but the 1 min bars aren't charted anyway. I'm looking at the chart on the strategy analyzer results.
But the 1min bars are not processed on that day before 22:15 GMT+0 (session start) because I see my exit order on that timeframe isn't hit until 22:15 and there are no Print()s from 1 min onBarUpdates.
NinjaTrader_Josh
07-02-2010, 02:17 PM
adamus,
Please be specific as to what instruments you are using exactly. What is the primary, what is the secondary? What is the session template applied to the primary series?
adamus
07-02-2010, 02:45 PM
This is on the GBP-USD forex pair. The primary bars are the 60mins, the second bars are the 1mins. The session template applied is the default selection on the Strategy property "Use instrument settings" and the instrument settings are unchanged from the installation, i.e. it is the Forex session template.
NinjaTrader_Josh
07-02-2010, 02:59 PM
Please test with attached strategy. It works on my end for both 60min prints and 1min prints. Tested dates: 3/3/2010 to 3/10/2010.
The 3/9 date printed all accurately.
adamus
07-02-2010, 03:16 PM
Hi Josh, I'm unable to unzip it. Can you check it please?
NinjaTrader_Josh
07-02-2010, 03:17 PM
adamus,
You do not need to unzip it. Please import the zip file through the NT import NinjaScript utility. http://www.ninjatrader.com/support/helpGuides/nt7/import.htm
adamus
07-02-2010, 05:42 PM
This is what I get:
BarsInProgress: 1 Time: 08/03/2010 23:55:00
BarsInProgress: 1 Time: 08/03/2010 23:56:00
BarsInProgress: 1 Time: 08/03/2010 23:57:00
BarsInProgress: 1 Time: 08/03/2010 23:58:00
BarsInProgress: 1 Time: 08/03/2010 23:59:00
BarsInProgress: 0 Time: 09/03/2010 00:00:00
BarsInProgress: 1 Time: 09/03/2010 00:00:00
BarsInProgress: 0 Time: 09/03/2010 01:00:00
BarsInProgress: 0 Time: 09/03/2010 02:00:00
BarsInProgress: 0 Time: 09/03/2010 03:00:00
BarsInProgress: 0 Time: 09/03/2010 04:00:00
BarsInProgress: 0 Time: 09/03/2010 05:00:00
BarsInProgress: 0 Time: 09/03/2010 06:00:00
BarsInProgress: 0 Time: 09/03/2010 07:00:00
BarsInProgress: 0 Time: 09/03/2010 08:00:00
BarsInProgress: 0 Time: 09/03/2010 09:00:00
BarsInProgress: 0 Time: 09/03/2010 10:00:00
BarsInProgress: 0 Time: 09/03/2010 11:00:00
BarsInProgress: 0 Time: 09/03/2010 12:00:00
BarsInProgress: 0 Time: 09/03/2010 13:00:00
BarsInProgress: 0 Time: 09/03/2010 14:00:00
BarsInProgress: 0 Time: 09/03/2010 15:00:00
BarsInProgress: 0 Time: 09/03/2010 16:00:00
BarsInProgress: 0 Time: 09/03/2010 17:00:00
BarsInProgress: 0 Time: 09/03/2010 18:00:00
BarsInProgress: 0 Time: 09/03/2010 19:00:00
BarsInProgress: 0 Time: 09/03/2010 20:00:00
BarsInProgress: 0 Time: 09/03/2010 21:00:00
BarsInProgress: 0 Time: 09/03/2010 22:00:00
BarsInProgress: 1 Time: 09/03/2010 22:16:00
BarsInProgress: 1 Time: 09/03/2010 22:17:00
BarsInProgress: 1 Time: 09/03/2010 22:18:00
BarsInProgress: 1 Time: 09/03/2010 22:19:00
BarsInProgress: 1 Time: 09/03/2010 22:20:00
NinjaTrader_Bertrand
07-03-2010, 01:36 AM
adamus, which datafeed would you use in this example? It seems you're missing data to me, have you tried after a fresh reload of all series used?