I have limited programming skills and tried in vain to alter the VolumeProfile (or even GomVolumeProfile) to initiate at start of RTH session and stop at the end of the session, eg for ES. I have played around with the ToTime function to achieve this, thinking surely it must be simple but it has alluded me. Anyone willing to help out will be much appreciated.
EDIT : Never mind - got it. It took me a week to figure it and only after my post did I realize what I had to do. Maybe by posting here I will be able to resolve some of my other queries!
Last edited by kashter; August 24th, 2010 at 07:22 PM.
Reason: Worked it out!
I assume that you use NinjaTrader 7. The only reliable method so far is Bars.FirstBarOfSession. This is a boolean, which has the value true, if the current bar is the first bar of the session, otherwise false. I think you can try to use it.
Do not use Bars.GetSessionBar() or Bars.GetSessionDate(), these methods are flawed, they sometimes work and sometimes don't.
The following user says Thank You to Fat Tails for this post:
thx for the tip - was initially playing with Bars.GetSessionBar() but I think I failed more due to broken logic. I then applied simple "if (ToTime(Time) > ToTime(08,30,00) ..." and works like a charm. Though very interested in learning C# code, and will experiment with Bars.FirstBarOfSession.
While I am at it, would you know how to identify and extract the longest bar in the VolumeProfile histogram. I could work the max volume (maxVolume) but not sure how to apply this to identify as to what price this refers to. Any hints. Much appreciated.
Its Sunday ad I have a bit of time on my sleeves, so that to progress with my Ninjascript/c# and modify GomVolumeProfile to suit my needs. I have included the time session and now want to highlight the peak volume histogram with a different color. I have managed to work out the value and bar but I am stuck with a little c# issue - how do you dynamically repaint the peak volume bar considering the peak bar changes all the time? I have the code below and does almost everything but I have no idea how to un-highlight prior peak volume bars. Any help is appreciated.
I am enjoying this C# - interesting stuff.
I tried to play with the DrawRectangle function as its "tag" attribute would have resolved this but wasn't successful.