NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-18-2012, 11:22 PM   #1
talolard
Junior Member
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default Daily data is shifted

Hello,
My strategy runs intraday but looks at daily charts at well.
I've added daily bar data with the following code in the init section:
Code:
Add(PeriodType.Minute, 1); // Adds a minute chart to Barsarray[1]
			
			Add(PeriodType.Day, 1); // Adds a Daily chart to Barsarray[2]
and I access it here for example:
Code:
(Math.Abs(Lows[2][0]- Opens[2][0]
So I've realized that the data that is being returned is offset by two days. That is, what the program reports as data from may 5th is actually data from may 3rd (for example).
I realized this by comparing the values of Open[2][0] / Close/ High for a particular day with the data from yahoo and google finance.
How do I fix this?
I am using data from Kinetick.
Thanks
Tal
talolard is offline  
Reply With Quote
Old 06-19-2012, 02:42 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

Hi Tal, thanks for the post - if you check the daily chart directly using Kinetick on your setup, would the dates be correct or shifted as well?

What time zone is your PC set up in and which session template are you using for your charts and running the strategy please?

Thanks,
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-19-2012, 04:00 AM   #3
talolard
Junior Member
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default

Hi Bertrand
If I upon a chart I get an off shift of one day. (I am looking at SPY and am using the flash crash of may 6 2010 as a reference point). When I open a chart it is labeled as 7th of may, When I check the strategy it happens on the 8th.

Session Template: default 24/7
Time Zone of my computer : GMT +2
Thanks
Tal
talolard is offline  
Reply With Quote
Old 06-19-2012, 04:05 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

Thanks Tal, please try using the 'US Equities RTH' template for example - would that correct the data for you?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-19-2012, 04:16 AM   #5
talolard
Junior Member
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default

Hi
This corrects it for the charts but not for the strategy.
The strategy now sees the dta if may 6th as may 7th (an improvment but not a solution).
Also, I would like to be able to run the strategy 24/7 to enjoy to pre and post market.
talolard is offline  
Reply With Quote
Old 06-19-2012, 04:19 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

Please leave it on this session template to ensure correct data visualization, the daily bar session is set by the provider - so the amount of data included in the bar does not change dynamically here with changing templates.

When you do you exactly try to access the 6th data? You could do so after the bar has closed, so the 7th would be the first possible location to do so.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-19-2012, 04:22 AM   #7
talolard
Junior Member
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default

Hmmm.
I want to see if the daily move is larger then a certain percent. So I'm taking to lowest low of the data and subtracting that from the daily open bar.
It wont be much help to do it on the next bar.
talolard is offline  
Reply With Quote
Old 06-19-2012, 04:24 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

You can do this in realtime or Market Replay as the intrabar formation is then known, but if you're backtesting first possible location would be the following bar...
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Shifted in Export Intraday Data Alvantage Miscellaneous Support 1 07-22-2011 11:11 AM
Some data from Yahoo is shifted by 1 day Alvantage Miscellaneous Support 7 04-08-2011 01:15 PM
Orders are shifted one day LaughingDwarf Strategy Development 3 03-14-2011 03:42 PM
Data minutes shifted 1 day and weekend issue WhoKnows Strategy Analyzer 11 12-16-2008 06:17 AM
Sma Shifted 3 in future jed77 Indicator Development 1 10-21-2008 09:49 AM


All times are GMT -6. The time now is 01:20 PM.