Announcement
Collapse
No announcement yet.
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:
Here does not work;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
I already check the local time date setting on both computers are same.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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment