Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 13 times


Postby RobotMan » 19 Sep 2008

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
Just cut and paste into the PowerEditor. Then delete the stuff at the bottom which is for visual help only.
(1.25 KiB) Downloaded 667 times

User avatar
Posts: 7458
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 999 times
Been thanked: 2137 times

Postby TJ » 16 Jan 2009

good stuff... thanks for sharing!

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times

Postby brodnicki steven » 16 Jan 2009

great idea- THX !

Return to “User Contributed Studies and Indicator Library”