NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-22-2007, 03:54 PM   #1
Lost Trader
Senior Member
 
Join Date: Oct 2007
Location: Tucson, AZ
Posts: 368
Thanks: 2
Thanked 2 times in 2 posts
Default Volume Bars color-coded according to Price change

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...
Attached Images
File Type: jpg volume.jpg (95.2 KB, 137 views)
Lost Trader is offline  
Reply With Quote
Old 10-22-2007, 05:19 PM   #2
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

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.)
Attached Files
File Type: zip VOL_MultiColor.zip (1.5 KB, 50 views)
KBJ is offline  
Reply With Quote
Old 10-22-2007, 06:28 PM   #3
Lost Trader
Senior Member
 
Join Date: Oct 2007
Location: Tucson, AZ
Posts: 368
Thanks: 2
Thanked 2 times in 2 posts
Smile

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
Attached Files
File Type: zip VOL_MultiColor 2.zip (1.6 KB, 75 views)
Lost Trader is offline  
Reply With Quote
The following user says thank you to Lost Trader for this post:
Old 10-22-2007, 07:07 PM   #4
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

Good job!

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

I like it better this way.
Attached Images
File Type: jpg Capture.JPG (96.2 KB, 170 views)
KBJ is offline  
Reply With Quote
Old 10-23-2007, 11:22 AM   #5
Lost Trader
Senior Member
 
Join Date: Oct 2007
Location: Tucson, AZ
Posts: 368
Thanks: 2
Thanked 2 times in 2 posts
Default

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?
Lost Trader is offline  
Reply With Quote
Old 10-23-2007, 08:30 PM   #6
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

The statement "CalculateOnBarClose = false;" can be placed anywhere in the Initialize() method.

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

KBJ is offline  
Reply With Quote
Old 10-23-2007, 11:15 PM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

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?
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Volume Bars Indicator (Download) Version 5 Only awuit Indicator Development 3 11-29-2007 04:25 PM
HMA (Hull Moving Average) color change Mexie Indicator Development 13 10-21-2007 08:58 AM
How . . . do I change color of Ray . . . . barrykish@comcast.net Charting 1 08-01-2007 02:24 PM
Momentum bars or Price Range Bars Akros Indicator Development 7 06-10-2007 04:55 AM
How to make the price ladder stop moving when no change in price Trinity Miscellaneous Support 1 08-02-2006 07:41 PM


All times are GMT -6. The time now is 09:51 AM.