Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
StartTime/EndTime format?
Collapse
X
-
Hello kenb2004,
The startTime and endTime are going to use a DateTime object not just an integer for a reference. For an example on how to use and modify DateTime objects you may view the following forum post for a sample.
http://www.ninjatrader.com/support/f...ad.php?t=19292
Please let me know if I can be of further assistance.JCNinjaTrader Customer Service
-
Hello kenb2004,
The SampleDateTimeFunctions shows the formats of the DateTime object use. So you could create a new DateTime object for the startTime and endTime of the object that you want to draw at those specific times.
Another reference that you can use is the VWAP indicator that creates new DateTime series at the following link.
http://www.ninjatrader.com/support/f...id=1&linkid=71
To read more information about DateTime you may view the following link.
http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
Please let me know if I can be of further assistance.JCNinjaTrader Customer Service
Comment
-
Ken,
There's always more than one way to do things and you're welcome to explore the best approach that works for you. The drawing object based on time requires a standard C# DateTime object, but each component (year, hour, minute, etc) could be built with an integer input if that's what you're looking to do.
Code:DateTime myDateTime = new DateTime(myYearInput, myMonthInput, myDayInput, myHourInput, myMinuteInput, mySecondinput);
Ryan M.NinjaTrader Customer Service
Comment
-
Hello kenb2004,
DateTime.Now will get a DateTime object that is set to the current date and time on this computer, expressed as the local time. Meaning that if you run the indicator at 2:23:35 PM today, it will return "7/16/2012 2:23:35 PM".
You can define a specific date and time when you create a new DateTime object for example:
Code:// Sets the myDateTime to July 16, 2012 at 8:49:00AM DateTime myDateTime = new DateTime(2012, 7, 16, 8, 49, 0 );
http://www.ninjatrader.com/support/h...tellisense.htm
Here is a link to our support forums that goes over how to debug your code which comes in handy when writing custom code to see how your code is being processed and to see what values are being set.
http://www.ninjatrader.com/support/f...ead.php?t=3418
Please let me know if I can be of further assistance.JCNinjaTrader Customer Service
Comment
-
Thank you for all the information concerning DateTime and all it's functions. But I still don't understand how using NinjaScript you would DrawRegion from 10 to 11 AM. Usually I would go to the Wizard and see how it does it but it's not there. Or I would go to the User Guide and search startTime or endTime but it only refers to it, but with no explanation.
I realize that DrawRegion is fairly new, but I would like to use the time property but I just don't know how. Maybe you or Josh could do a quick Sample using DrawRegion with a start and endtime property that draws every day at the same time. I'm sure it would be appreciated by others on this forum as well.
ThanksLast edited by kenb2004; 07-16-2012, 03:13 PM.
Comment
-
Hello kenb2004,
This will require you to set a DateTime object for the startTime and endTime to be able to define a time frame in which to draw. For example:
Code:// Sets the myStartTime to July 16, 2012 at 10:00:00AM DateTime myStartTime = new DateTime(2012, 7, 16, 10, 0, 0 ); // Sets the myEndTime to July 16, 2012 at 11:00:00AM DateTime myEndTime = new DateTime(2012, 7, 16, 11, 0, 0 );
There is a reference sample using DrawRegion that you may view at the following link.
http://www.ninjatrader.com/support/f...ead.php?t=4331
I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._resources.htm
The following link is a website that offers classes on programming in NinjaTrader that you may view for more programming experience and knowledge.
http://www.ninjaprogrammingschool.com/
Alternatively, If you have limited time or programming experience, you can discuss your requirements with any of our certified NinjaScript consultants at the link below.
http://www.ninjatrader.com/partners#...pt-Consultants
Please let me know if I can be of further assistance.JCNinjaTrader Customer Service
Comment
-
It's amazing, all I asked was a simple question as to the format NinjaTrader requires for startTime and endTime and I've been directed to the MSDN site, Ninja tutorials that don't cover this topic, 2 reference samples that do not create a startTime or endTime, a site to pay for programing education, and a site to hire a programmer. When all I asked was for a sample that would demonstrate the use of your own DateTime property in a drawing object. You have SampleIndicators for lot's of others why not one for startTime and endTime for DrawRegion daily from 10 to 11 AM.
Thanks
Comment
-
Ummm
Code:// Sets the myStartTime to July 16, 2012 at 10:00:00AM DateTime myStartTime = new DateTime(2012, 7, 16, 10, 0, 0 ); // Sets the myEndTime to July 16, 2012 at 11:00:00AM DateTime myEndTime = new DateTime(2012, 7, 16, 11, 0, 0 ); // Fills in the region between the upper and lower bollinger bands DrawRegion("tag1", myStartTime, myEndTime, CurrentBar, 0, Bollinger(2, 14).Upper, Bollinger(2, 14).Lower, Color.Empty, Color.Lime, 2);
Originally posted by kenb2004 View PostIt's amazing, all I asked was a simple question as to the format NinjaTrader requires for startTime and endTime and I've been directed to the MSDN site, Ninja tutorials that don't cover this topic, 2 reference samples that do not create a startTime or endTime, a site to pay for programing education, and a site to hire a programmer. When all I asked was for a sample that would demonstrate the use of your own DateTime property in a drawing object. You have SampleIndicators for lot's of others why not one for startTime and endTime for DrawRegion daily from 10 to 11 AM.
Thanks
Comment
-
Thanks sledge
// Sets the myStartTime to July 16, 2012 at 10:00:00AM
DateTime myStartTime = new DateTime(2012, 7, 16, 10, 0, 0 );
I see this code covers the 10 to 11 part, but this appears to be setting the startTime date to yesterday, how will this work for Today? What about the "daily" part? Normally when you want to capture the value of a bar, you would put "+CurrentBar" in the tag argument. With this code how do you capture the value of the DrawRegion so that 10 to 11 DrawRegion is unique for each day. Would you put
"tag1" + Time[0].Date.ToString(), in the tag argument?
But if your startTime date is yesterday's date, how will it draw Today?
ThanksLast edited by kenb2004; 07-17-2012, 05:02 AM.
Comment
-
Ken,
Instead of using this with hard set values.
DateTime myStartTime = new DateTime(2012, 7, 16, 10, 0, 0 );
You would instead use:
DateTime myStartTime = new DateTime(Time[0].Year.ToString() , Time[0].Month.ToString(), Time[0].Day.ToString(), 10, 0, 0 );
This is working with DateTime structures which is a core c# component.
-Brett
- Likes 1
Comment
-
Bret
This is perfect. Thank you very much. Just 2 other questions.
1. Why DateTime and not ToTime?
2. Would NinjaTrader consider an addition to Syntax for Drawing objects including ToTime startTime and endTime for those traders who only need hhmmss without the bulk of DateTime coding?
Thanks again
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, Today, 08:18 PM
|
0 responses
2 views
0 likes
|
Last Post
by judysamnt7
Today, 08:18 PM
|
||
Started by Blaze212, Today, 06:16 PM
|
0 responses
8 views
0 likes
|
Last Post
by Blaze212
Today, 06:16 PM
|
||
Started by visvabalaji, 02-12-2024, 04:38 PM
|
2 responses
515 views
0 likes
|
Last Post
by 0xikem
Today, 05:49 PM
|
||
Started by AmberBamber1999, 11-01-2023, 02:40 PM
|
5 responses
132 views
0 likes
|
Last Post Today, 05:14 PM | ||
Started by ThatMikey, Yesterday, 10:30 AM
|
23 responses
797 views
4 likes
|
Last Post
by BarzTrading
Today, 04:59 PM
|
Comment