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
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.Kate W.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Rogers101, 05-05-2024, 11:30 AM
|
9 responses
32 views
0 likes
|
Last Post Today, 07:49 AM | ||
Started by Quanto, 04-17-2024, 10:43 AM
|
3 responses
28 views
0 likes
|
Last Post Today, 07:49 AM | ||
Started by Mindset, Yesterday, 06:19 AM
|
3 responses
17 views
0 likes
|
Last Post Today, 07:44 AM | ||
Started by llanqui, Today, 07:04 AM
|
1 response
5 views
0 likes
|
Last Post Today, 07:36 AM | ||
Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
|
20 responses
114 views
0 likes
|
Last Post Today, 07:34 AM |
Comment