Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
detect R session bars
Collapse
X
-
Hello afshinmoshrefi,
Thank you for your post and thank you to Koganam for their response.
You would need to use a Session Template that would encompass all hours, ETH and RTH. Then check if the Time[0] is greater than the ToTime() for the RTH Session End and less than ETH hours Session End. Less than the RTH Session End would mean it is RTH hours.
However, each Session will have different start and end times, so both the Session End and Start will need to be checked against Time[0]. Please let me know if you have any questions.
-
You can use only one Session Template on a chart. If you want to make any finer distinctions of what time a bar is made, you will have to create and use your own time filters, and maybe a boolean flag or two.Originally posted by afshinmoshrefi View PostHow can I detect R session bars vs E session bars for ES? . I have tried the following code from the help files on 15min bars - this is placed inside OnBarUpdate:
if (Bars.FirstBarOfSession)
{
Bars.Session.GetNextBeginEnd(BarsArray[0], 0, out sessionBegin, out sessionEnd);
Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd);
}
The default result from <Use instrument settings> template is :
Session Start: 7/10/2014 6:00:00 PM Session End: 7/11/2014 5:15:00 PM
Session Start: 7/13/2014 6:00:00 PM Session End: 7/14/2014 5:15:00 PM
Session Start: 7/14/2014 6:00:00 PM Session End: 7/15/2014 5:15:00 PM
Session Start: 7/15/2014 6:00:00 PM Session End: 7/16/2014 5:15:00 PM
Session Start: 7/16/2014 6:00:00 PM Session End: 7/17/2014 5:15:00 PM
Session Start: 7/17/2014 6:00:00 PM Session End: 7/18/2014 5:15:00 PM
How can I tell if the bar belongs to R session or E session?
Leave a comment:
-
detect R session bars
How can I detect R session bars vs E session bars for ES? . I have tried the following code from the help files on 15min bars - this is placed inside OnBarUpdate:
if (Bars.FirstBarOfSession)
{
Bars.Session.GetNextBeginEnd(BarsArray[0], 0, out sessionBegin, out sessionEnd);
Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd);
}
The default result from <Use instrument settings> template is :
Session Start: 7/10/2014 6:00:00 PM Session End: 7/11/2014 5:15:00 PM
Session Start: 7/13/2014 6:00:00 PM Session End: 7/14/2014 5:15:00 PM
Session Start: 7/14/2014 6:00:00 PM Session End: 7/15/2014 5:15:00 PM
Session Start: 7/15/2014 6:00:00 PM Session End: 7/16/2014 5:15:00 PM
Session Start: 7/16/2014 6:00:00 PM Session End: 7/17/2014 5:15:00 PM
Session Start: 7/17/2014 6:00:00 PM Session End: 7/18/2014 5:15:00 PM
How can I tell if the bar belongs to R session or E session?Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
134 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
75 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
119 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
114 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
90 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Leave a comment: