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?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Closes Issue
Collapse
X
-
Closes Issue
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?Tags: None
-
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:
Ryan M.NinjaTrader Customer Service
-
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
Comment
-
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 -
Code:if (BarsInProgress == 0) Print(BarsInProgress + " " + Time[0]); if (BarsInProgress == 1) Print(BarsInProgress + " " + Time[0]);
BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bmartz, 03-12-2024, 06:12 AM
|
4 responses
31 views
0 likes
|
Last Post
by bmartz
Today, 08:02 AM
|
||
Started by Aviram Y, Today, 05:29 AM
|
4 responses
12 views
0 likes
|
Last Post
by Aviram Y
Today, 07:57 AM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
3 responses
28 views
0 likes
|
Last Post Today, 07:41 AM | ||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
1 response
8 views
0 likes
|
Last Post Today, 07:30 AM | ||
Started by cls71, Today, 04:45 AM
|
1 response
7 views
0 likes
|
Last Post Today, 07:25 AM |
Comment