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
No announcement yet.
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 -
Then you see the historical time stamps as well as the current one in the output window, provided your time on the PC is synched correctly.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]
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
582 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment