I start the strategy live at 14:00 and get the print of time bars beyond this time, up to 15:00, when the strategy shold stop. How can that be?
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
historical bars
Collapse
X
-
historical bars
Hello, I am testing a strategy from the Strategies tab, the datafeed is from zen-fire. The bar size is 1 minute, I keep track of the bar times printing them to the output window. The position is closed at a fixed time, say at 15:00. I have removed the if(Historical) return block from OnBarUpdate().
I start the strategy live at 14:00 and get the print of time bars beyond this time, up to 15:00, when the strategy shold stop. How can that be?Tags: None
-
My question concerns the fact that, when submitting live my strategy, the OnBarUpdate() runs over historical bars beyond the actual time displayed on my PC. It was 14:00 and got Time[0] for historical bars
equal to 14:01, 14:02, 14:03, 14:04, and so on ...
I closed NT and reconnected and this problem has gone away.
Comment
-
I have attached a test strategy to illustrate the problem. If I run this LiveTest on ES 03-06 I create a file for each bar on the directory C:\scratch; in my time zone (Central European Time) the program creates files from Bar00000.txt to Bar233000.txt, and my local time is 15:34 now. To what day do the Bar153500, Bar153600,... data refer to?
In other terms, if I run the strategy on real time data (Simulation Trade), I get approx 24 hours of bars, with a timestamp which in the future with respect to my actual time, and this causes some problems. Thanks.Attached Files
Comment
-
Hi, thanks I will take a look at your strategy - meanwhile please try this simple snippet in the strategy OnBarUpdate() with CalcuateOnBarClose set to true -
Code:[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] OnBarUpdate() { Print(CurrentBar [SIZE=2][SIZE=2]+ [/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + T[/SIZE][/SIZE]ime[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]].ToString()); } [/SIZE][/SIZE]
BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by moneyexe, Today, 11:22 AM
|
1 response
9 views
0 likes
|
Last Post Today, 11:32 AM | ||
Started by stevec1824, Today, 11:00 AM
|
2 responses
5 views
0 likes
|
Last Post
by stevec1824
Today, 11:32 AM
|
||
Started by sofortune, Today, 10:05 AM
|
2 responses
9 views
0 likes
|
Last Post
by sofortune
Today, 10:58 AM
|
||
Started by sofortune, 05-10-2024, 10:28 AM
|
6 responses
46 views
0 likes
|
Last Post
by sofortune
Today, 10:07 AM
|
||
Started by ETFVoyageur, Today, 08:54 AM
|
3 responses
31 views
0 likes
|
Last Post
by ETFVoyageur
Today, 09:23 AM
|
Comment