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 07-07-2007, 01:58 PM   #1
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default % Grid Line

I would like to have a line at a specific location in the indicator window. For example at the 80% Grid level. Is this possible?
AO76 is offline  
Reply With Quote
Old 07-07-2007, 02:09 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

If you use any of the provided Draw() methods, you must put in an absolute y value. Provided that the indicator was showing a value of 0 through 100 (such as stochastics) then you would just put in a value of 80 for the y value parameter in a Draw() method.

If you want to draw a line at 80% level in reference to the overall drawing space (pixels) this can be done by overriding the Plot() method. Doing this is advanced and requires some understanding of the .NET graphics class. You can see the CustomPlotSample indicator for reference.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-07-2007, 02:27 PM   #3
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

Fair enough.

I would like to plot on the "Zero Line" a changing line. When the Regression Channel is rising I would like to plot a "Green" Line, when the Regression Line is falling I would like to plot a "Red" Line. I'm having problems implementing this. I've attached a the indicator so you could see what I'm trying to do.

edit: That's a bad example, as I don't have the zero line changing colors. But I think you get the idea.
Attached Images
File Type: png MACD.png (7.9 KB, 22 views)
AO76 is offline  
Reply With Quote
Old 07-07-2007, 03:32 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Would just having the zero line dynamically change color be sufficient? If yes, just do something like:

if (rising)
Lines[0].Pen.Color = Color.Green;
else
Lines[0].Pen.Color = Color.Red;

Where [0] references the index where the zero line resides in the Lines collection. If you only have one line in the indicator, it would be index 0.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-07-2007, 03:35 PM   #5
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Ray for your help. I wish I was better at this stuff.
AO76 is offline  
Reply With Quote
Old 07-07-2007, 03:56 PM   #6
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

I think I'm getting close -- but I still can't seem to get it. My indicator is very similar to Woodies CCI that's why I was asking to see the code, it would have helped immensely.
Attached Images
File Type: png MACD.png (26.3 KB, 23 views)
Last edited by AO76; 07-07-2007 at 03:58 PM.
AO76 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
Adjusting grid lines Lupus Charting 10 09-14-2010 05:05 AM
Line "names" in Indicator Box change to "Line" after modification higler Charting 3 05-02-2007 06:05 AM
Performance grid sorting in version 6 beta 8 ThePatientOne Suggestions And Feedback 1 03-06-2007 01:18 AM
Horizontal Grid Lines at Price Intervals Quicktrader10 Charting 1 01-05-2007 06:04 AM
horiz grid lines Lupus Suggestions And Feedback 5 10-21-2006 02:02 PM


All times are GMT -6. The time now is 03:04 PM.