PDA

View Full Version : Volume Bars color-coded according to Price change


Lost Trader
10-22-2007, 03:54 PM
Every other charting package I've used allows the Volume Bars to be color-coded based on Current Price compared to previous Price (e.g., at previous bar close). Ideally with support for three colors (<, ==, >)

It is a fairly basic function that I cannot find in NinjaTrader.

Is it being added?
If not how can it be coded? I am fairly good at pattern matching...

KBJ
10-22-2007, 05:19 PM
This doesn't do everything that's in your screen shot, but it only took a couple of minutes to do and it's a start (see attached.)

Lost Trader
10-22-2007, 06:28 PM
KBJ, Thank you!!!!
That looks good.

By reading the cs file, it looked like I could modify to get what I wanted...
Changed up color to black, down to red, added a 3rd equal color of mediumOrchid (~light purple), and changed the test to reference [Price] Close instead of Volume.

It looks good! I'll test it out over the next day or so...
Thank you very much for your help -- getting started with something new can be a challenge initially.

Appreciate the help

KBJ
10-22-2007, 07:07 PM
Good job!

I was wondering when the purple bars were supposed to be drawn.

I like it better this way.

Lost Trader
10-23-2007, 11:22 AM
Interesting, KBJ... Often, price bars are colored red if falling, green (or black) if rising. So I tend to associate
.... red volume with falling price and
.... black (or green) volume with rising price.

BTW, from reading the manual,
CalculateOnBarClose = false;
is the ONLY way to get intrabar updates -- which obviously I need on Volume bars. So does that mean I should add the stmt immediately before the closing bracket } of the protected override void Initialize() section as the very last stmt in that section, in order to make that the default?

Finally, I need some extra Y-axis clear space over the Volume bars (so I could draw some lines) and that caused my 0 line to rise also -- now I have some wasted empty space underneath Volume (since Volume cannot be negative). Is there a way to instruct the software that this value (plot) should always keep 0 at the bottom of the panel?

KBJ
10-23-2007, 08:30 PM
The statement "CalculateOnBarClose = false;" can be placed anywhere in the Initialize() method.

I don't know how to adjust the vertical space.

NinjaTrader_Josh
10-23-2007, 11:15 PM
There may be some more advanced plot overriding techniques you can use to achieve it, but it would require a lot more advance programming then that of which we provide support for. Perhaps you could try clicking on the y-axis scale and dragging it up and down to adjust it?