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 johnMoss, 03-04-2024, 01:53 PM
|
3 responses
47 views
0 likes
|
Last Post
by AndyM
Today, 06:13 PM
|
||
Started by algospoke, Today, 06:01 PM
|
0 responses
8 views
0 likes
|
Last Post
by algospoke
Today, 06:01 PM
|
||
Started by cre8able, Today, 05:53 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 05:53 PM
|
||
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
32 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
Comment