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-02-2008, 11:42 AM   #1
atangram
Junior Member
 
Join Date: Sep 2008
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default Can I draw an arrow that stays on the top or bottom of a price chart?

I am working on an indicator that draws an arrow with some text on the chart at a candle. Right now, I am calculating the lowest and highest of all of the prices and indicators (MAs and Bollinger Bands) at that bar and drawing the arrow a few pixels below or above those prices. This works but it is not pretty and the spacing varies extremely when I switch from higher "priced" instruments (like ^DJIA) to cheaper ones (like JASO).

Is there any way that I can place an arrow and text on or near the bottom (and top) edges of the price panel and have it stay in the same relative place no matter how the chart is scaled? I want the arrow to point to a specific, calculated candle but to sit on the bottom or top margin no matter how I scroll the x-axis or scale the vertical axis. I have searched all over this site and also in other indicators but I just cannot find this. I have found a few kernels of ideas, but I am stumped. If there is a property that displays the Y-axis min and max, I think that would work... I just cannot find it.

Thanks in advance...
atangram is offline  
Reply With Quote
Old 10-02-2008, 11:48 AM   #2
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

Hi atangram,

First off, welcome to the NinjaTrader Support Forums. Unfortunately you cannot set the location of the arrow and text in the manner you want. The drawn arrow requires a certain y-value that correesponds with the y-axis and will move away if your y-axis moves too far. For text, you can use DrawTextFixed(), but that will just have an overlay text not correlated with your signal bar. It will just have a string of text sitting at whatever position you wanted.

You can try overriding the Plot() method, but this is unfortunately too advanced programming that is outside the scope of what we can offer support for.
Last edited by NinjaTrader_Josh; 10-02-2008 at 11:51 AM.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-02-2008, 12:01 PM   #3
atangram
Junior Member
 
Join Date: Sep 2008
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

Josh, Thanks for the quick reply. I will try to override the Plot() function but I still need to know the y-scale min and max values. Can you give me a little hint on where that property lives? Or even better, can you point me to an indicator that uses this property?
atangram is offline  
Reply With Quote
Old 10-02-2008, 12:06 PM   #4
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

Hi atangram,

The closest thing I can direct you to would be the CustomPlotSample preinstalled with your NinjaTrader as an indicator. Unfortunately I cannot provide more support than that on this endeavour. Good luck.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-21-2010, 09:01 AM   #5
matt3m
Junior Member
 
Join Date: May 2010
Posts: 29
Thanks: 3
Thanked 0 times in 0 posts
Default

I know this is an old thread, but I believe I have exactly this same question. Maybe NT 7 has a solution to this?

I want to put an arrow corresponding to a specific bar on top of the chart panel. Basically, instead of

DrawTriangleUp("My dot" + CurrentBar, true, 0, High[0], Color.Green);

it would be something like

DrawTriangleUp("My dot" + CurrentBar, true, 0, Top_of_frame, Color.Green);


This would make it so that if I y axis, the triangle is always visible at the top of the chart.

If it is possible to do that, then is it possible to "stack them". Let's say I had two indicators, and I wanted one to be underneither the other, is that possible? How?

Thanks,
Matt
matt3m is offline  
Reply With Quote
Old 09-21-2010, 09:53 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

Matt,

To do this still requires the use of the Plot() method.

Alternatively, you could try using DrawTextFixed() while using a font like Wingdings to draw some triangles. Those would be locked on the chart either on top or bottom of the panel. If you have multiple indicators that require stacking, you would need to add some enter lines to space them out so they don't overlap.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-21-2010, 09:57 AM   #7
matt3m
Junior Member
 
Join Date: May 2010
Posts: 29
Thanks: 3
Thanked 0 times in 0 posts
Default

Thanks Josh for your quick response.

However, I require that the arrow or ^ or v to be directly over a specific bar. The DrawTextFixed does not allow you to position text in that manner, see below.
Any other ideas?

Thanks,
Matt

DrawTextFixed(string tag, string text, TextPosition textPosition)

TextPosition
TextPosition.BottomLeft
TextPosition.BottomRight
TextPosition.Center
TextPosition.TopLeft
TextPosition.TopRight
matt3m is offline  
Reply With Quote
Old 09-21-2010, 10:05 AM   #8
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

Matt,

You will then have to override the Plot() method.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-18-2010, 12:24 AM   #9
djkiwi
Senior Member
 
Join Date: Mar 2010
Posts: 320
Thanks: 87
Thanked 5 times in 5 posts
Default Drawtext fixed

Hi Josh can you please elaborate on this:

"Alternatively, you could try using DrawTextFixed() while using a font like Wingdings to draw some triangles. Those would be locked on the chart either on top or bottom of the panel. If you have multiple indicators that require stacking, you would need to add some enter lines to space them out so they don't overlap. "

I am using drawtextfixed on top right corner of the hart. I want to put more text down underneath. Here is the text as an example:

DrawTextFixed("Deltapos1", (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), bPosition, Color.White, textFontMed, Color.Black, Color.Lime, 10);

So how would I put this on line 2 on top right of the chart? Thanks. DJ
djkiwi is offline  
Reply With Quote
Old 12-18-2010, 02:59 PM   #10
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

djkiwi, when creating the string you wish to display, please include a line break that separetes the top line from the bottom line. To include a line break, please add this to your string at the appropriate location:
Code:
"/r/n"
/r/n is the set of characters that will include a line break in your string.

Please let us know if you have any other questions.
NinjaTrader_Austin 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
draw arrow based on another drawing object duck_CA NinjaScript File Sharing Discussion 3 08-25-2008 03:18 PM
draw on price panel argito Strategy Development 8 06-09-2008 10:09 AM
how to read top or bottom of chart? NinjaCustomer Indicator Development 5 05-18-2008 10:20 PM
Volume Bar on Top/Bottom of Price Candle? shortorlong Indicator Development 0 03-25-2008 12:20 AM
chart get compressed down at bottom nkhoi Miscellaneous Support 2 01-28-2008 06:07 AM


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