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 Bobin, 03-12-2024, 08:51 AM
|
15 responses
479 views
0 likes
|
Last Post
by fiddich
Today, 03:41 PM
|
||
Started by Skifree, Today, 11:21 AM
|
4 responses
12 views
0 likes
|
Last Post
by Skifree
Today, 03:41 PM
|
||
Started by Bogdan097, Today, 03:25 PM
|
0 responses
3 views
0 likes
|
Last Post
by Bogdan097
Today, 03:25 PM
|
||
Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
|
25 responses
126 views
0 likes
|
Last Post Today, 03:16 PM | ||
Started by Mupulen, 04-16-2024, 11:26 AM
|
1 response
55 views
0 likes
|
Last Post
by techbech
Today, 03:03 PM
|
Comment