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
Time setting.
Collapse
X
-
Hallo Ralph
I have one more question to the sample you send me time ago[CODE]DateTime Start = DateTime.MaxValue
DateTime Stop = DateTime.MinValue
...
if(ToTime(Time[0]) == ToTime(20,45,0))
{
Start = Time[0]
Stop = Start.AddMinutes(405)
}
...
if(Time[0] >= Start && Time[0] <= End)
{
here we go
}/CODE]
How to make variable represent 20,45,00 ??
Rgds
Czarek.
Comment
-
Hello.
I make the coded time setting according this sample:
[CODE]DateTime.MaxValue
DateTime Stop = DateTime.MinValue
...
if(ToTime(Time[0]) == ToTime(20,45,0))
{
Start = Time[0]
Stop = Start.AddMinutes(405)
}
...
if(Time[0] >= Start && Time[0] <= End)
{
here we go
}/CODE]/CODE]
I works well on the computer I create the strategy.
When I transfer strategy to another compter problems apperaed.
I got 2 different results in output windows:
Here works well:
Code:7/8/2009 3:52:48Start =31/12/9999 23:59:59 7/8/2009 3:52:48Stop =1/1/0001 0:00:00
Code:7/8/2009 3:52:48Start =6/8/2009 23:59:59 7/8/2009 3:52:48Stop =6/8/2009 0:00:00
Where can I fix this setting.
Rgds
Czarek
Comment
-
Hi Czarek,
not sure what you are describing in your code snippets.
7/8/2009 3:52:48Start =31/12/9999 23:59:59
7/8/2009 3:52:48Stop =1/1/0001 0:00:00
The numbers above represent the DateTime.MaxValue and DateTime.MinValue.
7/8/2009 3:52:48Start =6/8/2009 23:59:59
7/8/2009 3:52:48Stop =6/8/2009 0:00:00
And these numbers above represent something based on some calculations: Two time-stamps with a distance of nearly 24 hours.
???
Regards
Ralph
Comment
-
Ralph.
This is what have been shown in output window on two different computers.
Same code works in different on different computers. Both has same data time system setting. I do not know why same code works different.
I just add ToDay to the code and the problem gone.
[CODE]if(ToTime(Time[0]) == ToTime(20,45,0)) && (ToDay(Time[0]) >= 20090807)CODE]
Rgds
Czarek
Comment
-
Here is another observation: If the print of the results displays the initial values (MinValue, MaxValue), then the if-condition was not hit.
A statement like:
if(ToTime(Time[0]) == ToTime(20,45,0))
may work for a 15-minute-chart but may not work for a 10-minute-chart. An alternate solution could be:
if(ToTime(Time[0]) >= ToTime(20,45,0))
Regards
Ralph
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ageeholdings, Today, 07:43 AM
|
0 responses
7 views
0 likes
|
Last Post
by ageeholdings
Today, 07:43 AM
|
||
Started by pibrew, Today, 06:37 AM
|
0 responses
4 views
0 likes
|
Last Post
by pibrew
Today, 06:37 AM
|
||
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
14 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
12 views
0 likes
|
Last Post Today, 12:38 AM |
Comment