Thx.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Date time as input variables
Collapse
X
-
Originally posted by Hawk Arps View PostIf I want to use a date and a time as an input variable, under what 'class' do I declare them, and in what format do I input them?
Thx.
If by "time", you mean a time of day, sans the date, that will be a TimeSpan variable.Last edited by koganam; 01-08-2012, 06:41 PM.
Comment
-
Originally posted by Hawk Arps View PostDoes this mean that if I want to declare a date and a time input variable and default them to 6:30 AM Sept. 1, 2011 I would use the following code?
(within Variables)
new DateTime StartDate=2011,09,01;
new DateTime StartTime=06:30:00;
It should be properly declared as:
Code:TimeSpan StartTime = new TimeSpan(6, 30, 00);
Last edited by koganam; 01-10-2012, 01:33 AM.
Comment
-
Thank you for your help... But I'm still pretty confused on how to declare a date (ie: Sept,1,2011) as an input and how to compare the current bar date to that date in the code. Everything I'm trying is getting compiler error code CS0120. Obviously I'm still pretty low on the learning curve...
Comment
-
I see... this indicator only works in real time. If I want to mark past times I assume I would change the DateTime.Now in the code DateTime(DateTime.Now.Year,DateTime.Now.Month,Date Time.Now.Day..... to Time[0].Date
Again thanks for the help. I'm slowly getting it (I think).
Comment
-
Hello NT,
I'm resurrecting this really old thread because it is somewhat close to what I'm trying to do. Hawk Arps was trying to mark out past dates. Bertrand gave him an indicator called DatetimeVerticalLines.cs. Hawk Arps was able to catch on how to mark past dates, but I'm still lost. Here is where the thread left off:
I see... this indicator only works in real time. If I want to mark past times I assume I would change the DateTime.Now in the code DateTime(DateTime.Now.Year,DateTime.Now.Month,Date Time.Now.Day..... to Time[0].Date
Again thanks for the help. I'm slowly getting it (I think).
Thanks
Gennaker
Comment
-
Hello Gennaker,
Thank you for the follow up.
You may use this constructor to specify a date to draw a line:
DrawVerticalLine(string tag, DateTime time, Color color, DashStyle dashStyle, int width)[/CODE]
Exemplar:
Code:DrawVerticalLine("My Line", new DateTime(2017, 7, 19, 12, 0, 0), Color.Red, DashStyle.Solid, 2);
More on DrawVerticalLine() here:
Please let us know if we may be of any further assistance.Chris L.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by dominikstiffel, Today, 05:24 AM
|
0 responses
4 views
0 likes
|
Last Post
![]() |
||
Started by kathleenjonathan993, Today, 03:18 AM
|
0 responses
5 views
0 likes
|
Last Post
![]() |
||
Started by SiebertCowen, Yesterday, 11:58 PM
|
0 responses
7 views
0 likes
|
Last Post
![]()
by SiebertCowen
Yesterday, 11:58 PM
|
||
Started by hunghnguyen2016, Yesterday, 08:00 PM
|
0 responses
12 views
0 likes
|
Last Post
![]() |
||
Started by cbentrikin, Yesterday, 03:49 PM
|
0 responses
17 views
0 likes
|
Last Post
![]()
by cbentrikin
Yesterday, 03:49 PM
|
Comment