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 05-22-2008, 11:30 AM   #1
TiP2012
Junior Member
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 times in 0 posts
Default Change volume bar color based on price and volume range

Hi,

I wanted to code an indicator which changes the color of the volume bars based on criteria derived from the range / volume of each bar.

e.g.

Value2 = Volume *Range;
If Value2 = Highest(Value2,20) then BarColor = ClimaxColor;

BTW - This is taken from http://emini-watch.com/free-stuff/volume-indicator/

However when I try to program this in NT I can't get the Highest value of Volume * Range to compare to the current value as a result of a problem parsing the Value3 to the MAX() function.

EG:

double Value3 = Volume[0] * Range()[0];


if (CurrentBar < 1) // First bar?
{ // Yes.
Values[0].Set(Volume[0]); // Plot it as an "equal" volume.
return; // Done.
}
if (Value3[0] == MAX(Value3,20)[0])
Values[
2].Set(Volume[0]); // Yes. Plot it as an "Churn" volume.
else
Values[
0].Set(Volume[0]); // Yes. Plot it as an "equal" volume.
}
}

Can anyone help?

Thanks.

TiP2012
TiP2012 is offline  
Reply With Quote
Old 05-22-2008, 11:33 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

I suggest debugging your indicator as per here: http://www.ninjatrader-support.com/v...ead.php?t=3418
NinjaTrader_Dierk is offline  
Reply With Quote
Old 05-22-2008, 02:32 PM   #3
TiP2012
Junior Member
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 times in 0 posts
Default

OK - Found the problem and I am almost there...

One question though, how can I create an If() statement which contains two conditions, e.g.:

if ((V2MAX == Value2[0]) && (V3MAX == Value3[0]))
Values[
4].Set(Volume[0]);

Using "&&" doesn't seem to work.

Sorry for the really basic question, my programming experience is somewhat limited as you can tell although growing every day.

Thanks.

TiP2012 is offline  
Reply With Quote
Old 05-22-2008, 02:47 PM   #4
TiP2012
Junior Member
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 times in 0 posts
Default

Cancel that, I see it was a problem with the plot order.
TiP2012 is offline  
Reply With Quote
Old 05-23-2008, 07:50 PM   #5
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default

Hello,

I think someone is working on this already. Its called "Better Volume Beta"
See this link:
http://www.ninjatrader-support.com/v...ead.php?t=7457
dwalls is offline  
Reply With Quote
Old 05-26-2008, 08:09 AM   #6
TiP2012
Junior Member
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Dwalls, I found the other persons code and it is indeed the same thing.

TiP2012
TiP2012 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
Time histogram for tic, volume or range charts dwalls NinjaScript File Sharing Discussion 13 11-13-2008 09:27 AM
Volume Color NinjaTrader_Josh NinjaScript File Sharing Discussion 6 12-19-2007 08:36 AM
Problems testing for zero volume on range charts zoltran General Programming 14 12-04-2007 12:59 PM
Some Range Bars have zero volume scjohn Historical NinjaTrader 6.5 Beta Threads 5 11-09-2007 09:31 AM
Volume Bars color-coded according to Price change Lost Trader Indicator Development 6 10-23-2007 11:15 PM


All times are GMT -6. The time now is 11:54 AM.