detecting a session change [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: detecting a session change
Hello GTrader,
You need to compare the date/time of the bar with EndDay and EndTime members of SessionObject.
You need to compare the date/time of the bar with EndDay and EndTime members of SessionObject.
Re: detecting a session change
Hi Henry,
I can't find a use example of the session object or where the current session object resides. I see there is a collection of sessions in the Bars object but I'm not sure how to identify the current session.
I'm trying to create an indicator that resets on a session change. Maybe there is an example somewhere of something like this? I am basically trying to create 2 things:
a) Vwap that automatically resets on a session change (the current one requires a datetime input), and
b) A function that returns an adjusted price series that takes out session open gaps. This would be used as the basis for calculating gapless indicators.
I can't find a use example of the session object or where the current session object resides. I see there is a collection of sessions in the Bars object but I'm not sure how to identify the current session.
I'm trying to create an indicator that resets on a session change. Maybe there is an example somewhere of something like this? I am basically trying to create 2 things:
a) Vwap that automatically resets on a session change (the current one requires a datetime input), and
b) A function that returns an adjusted price series that takes out session open gaps. This would be used as the basis for calculating gapless indicators.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: detecting a session change [SOLVED]
`Bars.LastBarInSession` returns true if the current bar is the last bar of the session. And if this property returns false for the current bar, but was true for the previous bar, the current bar is the first bar of the session.i.e. how do i know this bar is either the last bar in a session or the first bar of a session?
See this topic for example, but do note that there is (or was, depending on your MC .NET version) a limitation (see here) which was changed in MC 9.0 beta 1.I can't find a use example of the session object or where the current session object resides. I see there is a collection of sessions in the Bars object but I'm not sure how to identify the current session.