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
clarification on bar values in multi-instrument strategy
Collapse
X
-
Hello YD777,
Thank you for your patience.
I have received information on this case that I would like to share.
The behavior is considered expected. The historical processing of timestamps will be performed in ascending order and force this to occur where as you would not see this in real-time processing as there is no bar ahead of the current real-time bar.
Please let me know if you have any questions.
-
Hello YD777,
Thank you for your patience.
I am working with our development team on this matter and when I have details I will follow up here.
Leave a comment:
-
Hello YD777,
Thank you for your patience.
I was able to reproduce this exactly on my end. I will follow up with you when I have any details on the matter.
Leave a comment:
-
All US Eastern Standard.
ABCD was imported as "beginning of bar Timestamps". And "Last"
Leave a comment:
-
Hello YD777,
Thank you for your response.
What time was the ABCD historical data file exported with and what time zone was the ES ##-## historical data file exported with?
I want to make sure my data is matching in my test.
Leave a comment:
-
Originally posted by NinjaTrader_PatrickH View PostHello YD777,
Thank you for the additional information.
I tested with ES and I see the Time bars updating past the bars for the ABCD but I do not see the behavior you detailed.
Are you using a specific Trading Hours Template for the ES?
Can you attach your historical ES data for the tested time period to your response? You can export data from the Tools > Historical Data window and the Load tab.
I look forward to your response.
What output do you get for ABCD at 16:02? Are you running it between 08/01/2014 and 08/05/2014 and comparing to 08/01/2014 - 08/06/2014?Attached Files
Leave a comment:
-
Hello YD777,
Thank you for the additional information.
I tested with ES and I see the Time bars updating past the bars for the ABCD but I do not see the behavior you detailed.
Are you using a specific Trading Hours Template for the ES?
Can you attach your historical ES data for the tested time period to your response? You can export data from the Tools > Historical Data window and the Load tab.
I look forward to your response.
Leave a comment:
-
Originally posted by NinjaTrader_PatrickH View PostHello YD777,
Thank you for your response.
I am asking how you are verifying the time at 16:02. Your data does not go to 16:02. Can you provide your Output that shows the time at 16:02?
The Strategy Analyzer processes bar by bar and not by time.
Please provide the full detail on how you verify the case at 16:02.
Print(Time[0] + " " + Closes[1][0] );
Time[0] is the time of the current bar calling OnBarUpdate. So if the primary instrument is a liquid instrument like ES, you'll get a moment at 16:02 (and 16:03, and 16:04, etc).
Closes[1][0] is the last close of the ABCD bar. Close[0][0] would be the close of ES (or any other instrument of your choice that has ticks at 16:02). I assume you guys have historical data on ES you can run as the primary instrument, but if not I can send you.
Leave a comment:
-
Hello YD777,
Thank you for your response.
I am asking how you are verifying the time at 16:02. Your data does not go to 16:02. Can you provide your Output that shows the time at 16:02?
The Strategy Analyzer processes bar by bar and not by time.
Please provide the full detail on how you verify the case at 16:02.
Leave a comment:
-
Originally posted by NinjaTrader_PatrickH View PostHello YD777,
Thank you for your post.
The Strategy Analyzer processes the data by bar. You state you are checking at 16:02 pm? How are you checking at this time? If this the PC clock time you are referring to?
I look forward to your response.
Print(Time[0] + " " + Closes[1][0] );
That line gets run when OnBarUpdate is called by the primary bars closing.
Leave a comment:
-
Hello YD777,
Thank you for your post.
Originally posted by YD777 View PostHowever, if I instead run the historical test to 8/6, the value of Closes[1][0] at 8/4 16:02 becomes 395.6000.
I look forward to your response.
Leave a comment:
-
Here is a basic strategy to show you what I mean. I've also attached data for instrument ABCD.
Code:public class Test2: Strategy { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "Test2"; Calculate = Calculate.OnBarClose; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; } else if (State == State.Configure) { AddDataSeries("ABCD",BarsPeriodType.Minute, 1); } } protected override void OnBarUpdate() { Print(Time[0] + " " + Closes[1][0] ); } }
Instrument: any that has ticks after 16:00, such as ES
Trading hours: default 24/7
Break at EOD: yes
Start Date: 08/01/2014
Run #1 with END DATE= 08/05/2014
output: 8/4/2014 4:02:00 PM 395.65
output: 8/4/2014 4:02:00 PM 395.6Attached Files
Leave a comment:
-
clarification on bar values in multi-instrument strategy
My brain is hung up on what I feel is an inconsistency in NT, possibly a serious bug. I'm hoping someone can clarify for me. As far as I understand it:
1. The value Closes[x][0] is the value for data series X at the close of the last COMPLETED bar in the data series X (not the current value of the bar in progress).
2. A bar is not completed until the NEXT bar opens for that instrument.
So here's my problem. I have data series ABCD as my secondary data series. It includes the following sequential minute bars (only closing values shown below).
8/4 15:58; 395.6500
8/4 15:59; 395.6000
8/5 02:00; 395.1000
Now, according to rules 1 & 2 above, on 8/4 16:02 the value of Closes[1][0] should be 395.6500 since the last completed bar would be the 15:58 bar above. And indeed, that is the value for Closes[1][0] when I run a historical test up to 8/5. However, if I instead run the historical test to 8/6, the value of Closes[1][0] at 8/4 16:02 becomes 395.6000.
The strategy analyzer seems to be inappropriately closing a bar prior to the open of the next bar. It does this when it sees a future bar in memory. This seems to be a serious issue, since in real-time it would not be able to see that future bar to close out the current bar. In the example above, the 15:59 bar should not close until 8/5 02:00.
Please help me on this issue. Thank you.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cre8able, Yesterday, 03:20 PM
|
3 responses
18 views
0 likes
|
Last Post
by cre8able
Today, 04:08 PM
|
||
Started by StrongLikeBull, Today, 04:05 PM
|
0 responses
4 views
0 likes
|
Last Post Today, 04:05 PM | ||
Started by The_Sec, Today, 03:53 PM
|
0 responses
6 views
0 likes
|
Last Post
by The_Sec
Today, 03:53 PM
|
||
Started by love2code2trade, Today, 01:45 PM
|
2 responses
13 views
0 likes
|
Last Post Today, 03:29 PM | ||
Started by stafe, 04-15-2024, 08:34 PM
|
4 responses
26 views
0 likes
|
Last Post
by stafe
Today, 03:27 PM
|
Leave a comment: