View Full Version : Closes Issue
NingNing
08-12-2010, 10:02 AM
Hi
I have a problem when calling Closes[3][0] as it is not capturing the latest bar in the history but the second latest one in the history. May be this is due to time zone issue? But I am thinking to write some codes to specifiy Closes of a date according to the history data, is it possible? say I want to get 12/12/2009 daily close, how to do it?
NinjaTrader_RyanM
08-12-2010, 10:09 AM
Hello NingNing,
This most likely has to do with the sequence of OnBarUpdates()
Daily bars are time stamped with the time the bar will end, and this will often be later than the primary series you are evaluating.
When using version 6.5 it is advised that any secondary series must be smaller than the first.
You can use GetBar() to return the bars ago value of a specific date / time. This reference sample can help with this:
http://www.ninjatrader.com/support/forum/showthread.php?t=19176
NingNing
08-12-2010, 10:31 AM
HI
I still struggle with it. Let me explain my problem again. I am backtesting from 1/8 to 12/8, and now is 12/8 in asia time. I have 1/8 to 11/8 FTSE cash index from YAHOO in Ninja. But when I do Add("FTSE", PeriodType.Day, 1) and do Closes[3][0]. The value is actually the one on 10/8 instead of 11/8 that I am expecting. Again, I am running it in asian time on 12/8 and FTSE has not yet closed on 12/8 so there is no new close data from yahoo. 11/8 close data is the last one I have. thx again
NinjaTrader_RyanM
08-12-2010, 10:43 AM
Hello NingNing,
This will depend on many factors.
Can you let us know which version you're using?
Are you evaluating on historical or real time bars?
What is your primary series?
If in real time, what is the time stamp of the daily bar?
NingNing
08-12-2010, 08:54 PM
Hi
My primary series is a 5Min bars on an asian index, and I am evaluating it using historical and real time data. I am still using 6.5 in fact. May I know how to know the time stamp for the market data? Please advise and thx again
NinjaTrader_Bertrand
08-13-2010, 05:20 AM
NingNing, for 6.5 please use the daily as primary, so you can add the (faster) 5 min one...then print the BarsInProgress and Time of the call to the output window to see how the call sequence works -
if (BarsInProgress == 0)
Print(BarsInProgress + " " + Time[0]);
if (BarsInProgress == 1)
Print(BarsInProgress + " " + Time[0]);
NingNing
09-14-2010, 09:26 AM
Hi
I switch to 7.0 and still meet the same problem. Can you advise? thx again
NinjaTrader_RyanM
09-14-2010, 09:55 AM
Hello NingNing,
Can you please share a simple strategy that illustrates what you're seeing? Let us know as well the primary series the strategy is run against, as well as the data feed you're using.