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-21-2008, 01:04 PM   #1
MrPips55
Junior Member
 
Join Date: Jun 2006
Location: , ,
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
Default Help with Color Bar indicator

This simple ColorBar indicator is not working. Can someone help?
Here is the code:
====================
protected override void OnBarUpdate()
{
//Are there enough bars
//if (CurrentBar < Period) return;
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

if (Close[0] > Open[0] && Close[0] > High[1])
{
BarColor = Color.Blue;
}
else if (Close[0] < Open[0] && Close[0] < Low[1])
{
BarColor = Color.Red;
}

else if (Close[0] >= Low[1] && Close[0] <= High[1])
{
BarColor = Color.Black;
}

}
===============
end
thanks!!!
MrPips55 is offline  
Reply With Quote
Old 10-21-2008, 03:00 PM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

Please put this at the top of your OnBarUpdate() block and see if it helps:

if(CurrentBar < 1) return;

(Or just delete the "//" marks from left of the CurrentBar condition you already have.)

This link will help:
http://www.ninjatrader-support.com/v...ead.php?t=3170

What is probably happening is you are referring to an index of 1 before it exists.
NinjaTrader_Ben is offline  
Reply With Quote
Old 10-25-2008, 03:28 PM   #3
prostyle
Junior Member
 
Join Date: Aug 2007
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Default quick question paint bars

Hello,

If you have the paint bar indicator or have ben able to get one do you mind sharing?

I use only bars when trading, I see there are lots of heikin ashi indicators
in this forum but nothing for strickly bars?

Please let me know, if I have to pay I will.

thanks,

Colin
prostyle 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
CCI (or any indicator) with changing color Jibu V Indicator Development 10 09-24-2010 07:07 AM
Select Color from Indicator Dialogue? tazatek Indicator Development 1 07-28-2008 03:36 PM
Color Stochastic/2-line Indicator jeremymgp NinjaScript File Sharing Discussion 11 01-05-2008 12:27 PM
Changing color of indicator and save it ceesvh Charting 1 08-02-2007 02:47 PM
Use Indicator plot color in DrawLine() MJT Indicator Development 1 06-01-2007 03:13 PM


All times are GMT -6. The time now is 07:36 AM.