Begin session and EndSession

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

Begin session and EndSession

Postby turbofib » 30 Sep 2017

I would like to know when the session begins and ends

if session end i use sessionlastbar..
But if session begin what i code it?


I see documentation and i see sessionStartTime

Should i use SessionStartTime?

if yes, i dont understand what is the parameter i use in

What is : SessionNum - a numerical expression specifying the Session Number

i need this session, i don't need to know the break time in the session but The Start And The End of Session..

I hope you can help me..thanks

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Begin session and EndSession

Postby rrams » 30 Sep 2017

Hello turbofib. Session times can be tricky to program so that the outcome is exactly the way you expect; but the code syntax is straight forward.

Session Numbers are pre-assigned in the Symbol Dictionary for each time-block a security trades during the week. Some instruments have just one number per day and trade Monday through Friday. Some futures start with Session Number one on Sunday and have two more sessions on Monday.

To get the SessionStartTime of the current bar you would need to use one of the built-in functions that returns the current session you are in as a parameter to the SessionStartTime function. The pre-built function CurrSessionNum(SessionType) returns that number or zero if you are currently between sessions during a break. You can just use 0=Auto Detect for Session Type so:

SessionStartTime(0, CurrSessionNum(0)) would return the start time in 24 hour format.

None of the Multicharts session number functions take into account differences in Daylight Saving Time; so if you are in a time zone that does not observe DST and the Exchange is currently on DST, then the function can return an incorrect result.

turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

Re: Begin session and EndSession

Postby turbofib » 30 Sep 2017

Mmm ok
If there is a boolean sessionlastbar why there isn't a boolean with sessionFirstBar??
I dont understand:((
Thank you

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Begin session and EndSession

Postby rrams » 30 Sep 2017

Because that would be trivial code. Once you know SessionLastBar, the begining of the next session would be the next bar.
Other people have gone through the learning process and contributed to this discussion before. viewtopic.php?t=10647 You are doing fine.


Return to “MultiCharts”