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 01-14-2008, 01:09 PM   #1
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default Adding a Text Marker to Constant Lines Indicator

Hi:
Probably a very simple answer to this one, so apologies for acting dumb.
I would like to add a text label (e.g. VAH, POC, VAL) to each of the four lines within the Constant Lines indicator - how does one do this with via NinjaScript?
Would appreciate any pointers.

many thx
David
dgregor5 is offline  
Reply With Quote
Old 01-14-2008, 01:35 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

You would need to use the DrawText() method.

http://www.ninjatrader-support.com/H.../DrawText.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-14-2008, 01:58 PM   #3
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray. I don't think that is what I am looking for??? I want something similar that the pivots indicator has, i.e. label associated with horizontal line which can vary from day to day whilst the label remains associated with it. e.g. Daily Pivot point = 13000 & there is a horizontal line at 13000 with a "Daily PP" automatically associated with it. Looking through the script for that particular indicator, it is not easy to ascertain how a label is associated with the value.

thx !!!
David
dgregor5 is offline  
Reply With Quote
Old 01-14-2008, 02:01 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

The label is custom drawn by overriding the indicator's plot method which is outside what we support at this time. There is a reference indicator provided called CustomPlotSample.
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-14-2008, 02:35 PM   #5
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

hmmm
was expecting this to be simple :-(
what I am trying to do is the following....................
I have approx 10 lines which i want to plot on a chart as areas of support or resistance (these will vary on a daily basis) & have labels associated with each line.
As part of a strategy, I will have a set of entry criteria & also criteria which if violated a trade cannot be entered. One of these will be if price is within 'x' ticks of a specific support or resistance level.
I was thinking of just simply developing the Constant lines indicator to do this..........it's easy to go from 4 to 10 constant lines in the strategy & associate a variable to them - what i also want to be able to do is add a label to each line.

any thoughts on how to achieve this?

thx
David
dgregor5 is offline  
Reply With Quote
Old 01-15-2008, 12:57 AM   #6
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

I don't see why you can't use DrawText to add the label onto the line. Have the text be drawn at the latest bar and have it with a y value a little bit above or below the intended line it is to label.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-15-2008, 01:54 AM   #7
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

thx Josh. for the response. I will give it a go.......
as you are probably aware by now, the big difference between you & I is that you are the expert !! :-)

thx
David
dgregor5 is offline  
Reply With Quote
Old 02-01-2008, 05:31 PM   #8
winJR
Member
 
Join Date: Jan 2008
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Default Dgregor5, did you get it?

I also am interested. I want to add a lable to a constant line. dont want the lable over in price axis but on the chart itself. Can someone post example of how to do this? maybe the constant line indicator already developed but have the draw text code on at least one of the lines, i can go in and do it for the other lines. thanks.
winJR is offline  
Reply With Quote
Old 02-02-2008, 01:02 AM   #9
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

winJR,

It is doable via the DrawText() method we mentioned earlier. I am unaware of a sample that shows what you want already, but perhaps the help guide article on DrawText() can provide you with enough guidance in achieving the desired effect.

http://www.ninjatrader-support.com/H.../DrawText.html
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-22-2008, 04:40 PM   #10
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

Also trying to label my lines. Anyone know how I can do this using the DrawText() Method?
Attached Images
File Type: png label.png (26.9 KB, 59 views)
AO76 is offline  
Reply With Quote
Old 11-22-2008, 04:54 PM   #11
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

Just use the DrawText() method and for your y value, just pass in the line value + a tick? That is likely the closest you can get without it being directly on top.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-22-2008, 06:23 PM   #12
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

Still can't get it to work.

Quote:
Originally Posted by NinjaTrader_Ray View Post
Just use the DrawText() method and for your y value, just pass in the line value + a tick? That is likely the closest you can get without it being directly on top.
Attached Images
File Type: png label.png (41.4 KB, 84 views)
AO76 is offline  
Reply With Quote
Old 11-23-2008, 12:37 PM   #13
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

AO76,

You are drawing 1 bar into the past. When you do this you need to first ensure you have enough bars loaded.

Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-23-2008, 11:47 PM   #14
AO76
Member
 
Join Date: May 2007
Location: , ,
Posts: 57
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Ray. Got it working.
AO76 is offline  
Reply With Quote
Old 01-11-2011, 10:35 AM   #15
Jim-Boulder
Senior Member
 
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
Default Has This Changed at all with NT 7?

Has the ability to place labels on a line on a chart been improved/changed with NT7? If not, is DrawText still the only way to do this (or at least the best way)?

As a suggestion (assuming this hasn't been addressed already)--it would be great if a label could be added as part of the options on a plot line (with the ability to turn the text on /off and to specify where to show the text (far right, far left, center of chart, etc.)...so it is easy to label a plot on a chart...

Just my 2 cents....
Jim-Boulder 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
Indicator: Using StreamReader to read from a text file NinjaTrader_Josh Reference Samples 0 09-30-2007 10:42 PM
Indicator: Using StreamWriter to write to a text file NinjaTrader_Josh Reference Samples 0 09-30-2007 10:38 PM
Indicator price marker(s) feature request. higler Suggestions And Feedback 1 08-08-2007 02:10 AM
Adding bookmarks to help text kekkis Suggestions And Feedback 1 08-02-2007 05:53 AM
No text or video in help guide for adding column to Market Analyzer daven Market Analyzer 6 06-18-2007 02:34 PM


All times are GMT -6. The time now is 01:40 PM.