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 cyberpete76, 03-27-2023, 12:29 AM
|
7 responses
267 views
1 like
|
Last Post
by slightly
Today, 01:47 AM
|
||
Started by renewsaltwater, Today, 01:15 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 01:15 AM | ||
Started by slightly, Today, 12:49 AM
|
0 responses
4 views
0 likes
|
Last Post
by slightly
Today, 12:49 AM
|
||
Started by sdauteuil, 09-23-2021, 10:16 AM
|
4 responses
1,210 views
0 likes
|
Last Post Yesterday, 11:41 PM | ||
Started by agclub, 04-21-2024, 08:57 PM
|
5 responses
39 views
0 likes
|
Last Post
by agclub
Yesterday, 09:47 PM
|
Comment