Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Bar Start Time in Playback
Collapse
X
-
Bar Start Time in Playback
I would like to create a strategy that trades after a certain time. Trading real time is pretty straight forward using DateTime.Now and comparing that to a specified DateTime. How would I go about doing this for backtesting? I'm having trouble figuring out how to find the date/time info of a bar. Is there a method for getting the timestamp of a bar or the start time?Tags: None
-
Hello lahmannjohn,
Thank you for your reply.
Time[0] would give you the time of the current bar both in backtesting and real time trading:
An example of a strategy that only trades within specified hours may be found in our help guide here:
If you want Playback time, you can consider using NinjaTrader.Cbi.Connection.PlaybackConnection.Now.
Please let us know if we may be of further assistance to you.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment