Let's say the session ends at 14:00. Then at 13:59:59 it executes. I will be a simple loop that checks if there's a timestamp at a particular time value, if there is, the variable lasttimestamp is assigned that value, otherwise it checks for the next last second, on, and on, until it finds one. I understand the logic, but I'm not sure about the syntax.
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
Last TimeStamp Of Session?
Collapse
X
-
Last TimeStamp Of Session?
I'm interested in code that will figure out the last timestamp of the session. At the absolute last second of the session it will look for the last timestamp using the OnMarketData method.
Let's say the session ends at 14:00. Then at 13:59:59 it executes. I will be a simple loop that checks if there's a timestamp at a particular time value, if there is, the variable lasttimestamp is assigned that value, otherwise it checks for the next last second, on, and on, until it finds one. I understand the logic, but I'm not sure about the syntax.Last edited by Srgtroy; 08-09-2012, 08:06 AM.Tags: None
-
Hello Srgtroy,
Thanks for the clarification.
You can simply get/store the value from the OnExecution event. A sample code will be like:
in variable
Code:DateTime lastTrade;
Code:protected override void OnExecution(IExecution execution) { lastTrade = execution.Time;
JoydeepNinjaTrader Customer Service
Comment
-
I think you misunderstand me. I'm not executing anything. I want the timestamp of the absolute last trade in a bar. Not my trade. Anyone's trade. The absolute last trade. The way ninja works, minute bars always end at 00. But this is not necessarily when the actual last trade occurred. That is what I am trying to determine and access!
Comment
-
JoydeepNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
9 responses
21 views
0 likes
|
Last Post Today, 03:27 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
7 responses
21 views
0 likes
|
Last Post Today, 03:26 PM | ||
Started by nandhumca, Today, 03:15 PM
|
1 response
2 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
||
Started by Lele2k24, Yesterday, 11:24 AM
|
12 responses
37 views
0 likes
|
Last Post Today, 03:07 PM |
Comment