Page 1 of 1

SessionBreaks.pla

Posted: 19 Sep 2008
by RobotMan
Why, in Multicharts tarnation, the sessionbreaks don't go all the way through all the subcharts makes me shake my head in wonder.
Here's a few lines of code that can be added to any indicator to allow for session breaks. Of course, I use TICK charts of CME globex emini - so beware, they might not work for you.

I tried using SessionLastBar, but that only gives me the last bar of the day, just like the single session break in the regular charts at 3:15 pm Chicago Time.

Also, SessionStartTime(1,1) gives an erroneous return. (ie: if the overnight session (session 1) Actually starts at 1530 Chicago Time (3:30 pm), SessionStartTime(1,1) = 1700 (5:00 pm). It's a bug. So I had to write a work around.

Also notice the use of "time_s[1]" for tick bars (bartype = 0). It allows the code to find the proper first bar of the next session and then put a vertical trendline on the bar before. Weird, huh. If drawing and text objects were only defined by price and barnumber, things would be simpler. Or there was some reserved word that you could go back and forth between Tick barnumbers (or Volume barnumbers, or Range barnumbers, or Moonphase barnumbers, etc) and time_s. Minute bars are so 1990's stock charts. But I digress... :wink:

edit 12/27/2008 - I discovered "FindBar(Date,Time)" which tells you the bars back from CurrentBar. So there's that.

Hope this helps,
Bob Perry
Los Altos, CA

Posted: 16 Jan 2009
by TJ
good stuff... thanks for sharing!

Posted: 16 Jan 2009
by brodnicki steven
great idea- THX !