if (ToTime(Time[0]) == Bars.SessionEnd.TimeOfDay)
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Compare bar time to session end time
Collapse
X
-
Compare bar time to session end time
I am trying to not submit an order at the end of a trading session time (which is set in the strategy Time Frame parameter list). I tried the following if statement but received an error that said I could not compare the two. How would I do this?
if (ToTime(Time[0]) == Bars.SessionEnd.TimeOfDay)Tags: None
-
Code:if (ToTime(Time[0]) == ToTime(Bars.SessionEnd))
Josh P.NinjaTrader Customer Service
-
Hi,
I tried implementing the code you mentioned above but am getting the following error:
'NinjaTrader.Data.Bars' does not contain a definition for 'SessionEnd' and no extension method 'SessionEnd' accepting a first argument of type 'NinjaTrader.Data.Bars' could be found (are you missing a using directive or an assembly reference?)
Can you please advise? I would like to be able to have my system stop trading before end of day. (Dont want to use 4pm comparison as some sessions end earlier)
Thx
Comment
-
-
With respect, Bertrand, y'all need to correct that link. I've been told that NT7 should not use Bars.SessionBreak but should use Bars.FirstBarOfSession instead.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:45 PM
|
2 responses
16 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
15 responses
3,272 views
0 likes
|
Last Post Today, 03:15 PM | ||
Started by Tim-c, Today, 02:10 PM
|
1 response
8 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
51 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
Comment