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 dustydbayer, Today, 01:59 AM
|
0 responses
1 view
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
0 responses
2 views
0 likes
|
Last Post
by inanazsocial
Today, 01:15 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
22 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
||
Started by guillembm, Yesterday, 11:25 AM
|
2 responses
10 views
0 likes
|
Last Post
by guillembm
Yesterday, 11:58 PM
|
Comment