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 02-23-2009, 09:20 AM   #1
rtj4201
Senior Member
 
Join Date: Jan 2009
Posts: 333
Thanks: 0
Thanked 0 times in 0 posts
Default Color Chart

I am new to NT and the ninjascript.

I wanted to color the chart green if the close was greater than the close 5 bars ago and color the chart red if the close was less than the close 5 bars ago.

Is this simple to do? Can it be done easily.

Not sure where to get started.
rtj4201 is offline  
Reply With Quote
Old 02-23-2009, 09:35 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,409
Thanks: 252
Thanked 975 times in 958 posts
Default

Hi rtj4201, first I would suggest you check out those tutorials on custom NinjaScript indicator coding - http://www.ninjatrader-support.com/H...verview18.html

For your idea, Tutorial 6 might be a good start.

As example, this would be your OnBarUpdate portion for coloring the bars green if the Close is great than the Close 5 bars ago -

Code:
if (CurrentBar < 5) 
return;

if (Close[0] > Close[5])
BarColor = Color.Green;
To understand while I added the first quick check to the code, please see this tip - http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Bertrand 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
Chart properties - bar color Lost Trader Charting 17 10-05-2012 07:18 AM
EMA Color not drawing on the chart rnr123 General Programming 1 01-21-2009 03:41 PM
Chart default test color? higler Miscellaneous Support 1 05-09-2008 05:44 AM
Color of background on chart edgeliner General Programming 1 11-20-2007 04:32 AM
Chart Background Color NinjaTrader_Josh General Programming 1 07-15-2007 03:36 PM


All times are GMT -6. The time now is 05:40 AM.