![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Nov 2007
Posts: 63
Thanks: 0
Thanked 0 times in 0 posts
|
I draw four horizontal dotted lines in an indicator panel (values 0, 0.5, 1, and 1.5), and I change the colors for each bar depending on price action. I would add to add a label (text) to the left on each of those lines to indicate their function. I would obviously like for the label to remain in the same place (left-most side of the indicator panel) as I scroll through time. How do I do this?
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
You can set DrawOnPricePanel to false and then use DrawTextFixed() with a left side alignment -
http://www.ninjatrader-support.com/H...TextFixed.html
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Nov 2007
Posts: 63
Thanks: 0
Thanked 0 times in 0 posts
|
Hi, unfortunately the suggestion doesn't work for what I am trying to do. I have attached a screen print to show you my indicator (http://www.screencast.com/t/Yjk1MjMwM). As you can see it displays five lines of diamonds. I would like to ask a word of text to the left of those lines of diamond to explain which study the line relates to. DrawText may be the solution and the y value is not a problem, however I don't know how to reference the x/time value to coincide with the left most side of the screen. Thanks in advance for your help.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
You have to use DrawTextFixed() if you want it to correspond with left edge as opposed to a certain bar. DrawText() is tied to bars and as you scroll around it will move while DrawTextFixed() is "fixed" onto the chart on certain corners.
If you want it to be "fixed" but at locations of your choosing unfortunately this is not supported and you would have to override the Plot() method and custom program that in yourself.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Nov 2007
Posts: 63
Thanks: 0
Thanked 0 times in 0 posts
|
Any good example out there of overriding the Plot() method?
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Overriding the Plot() method is outside the scope of what we can offer support for and we unfortunately do not have any samples.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
|
I just would like to know *if it is possible* to override Plot() in panel 2? I know "how" to do it just want to know if it is possible, yes or no.
|
|
|
|
|
|
#8 |
|
Senior Member
|
I'll answer that -> yes it is
|
|
|
|
|
|
#9 |
|
Senior Member
|
The x-coordinate value for the left side of the screen would be ChartControl.FirstBarPainted, so the value you would use for the startBarsAgo witl be (CurrentBar - ChartControl.FirstBarPainted).
Example: Code:
int LeftSideOfScreen = ChartControl.FirstBarPainted;
DrawText("Test", false, "Text to show at left side of screen",
(CurrentBar - LeftSideOfScreen), Close[0], 0, Color.Blue, new Font("Arial" , 12),
StringAlignment.Near, Color.Transparent, Color.Transparent, 5);
Be aware that all use of ChartControl functions will not get any support from NT, so use at your own risk. It could change in the future, which I am sure, is partly why they refuse to provide any support for it.
Last edited by koganam; 06-27-2011 at 09:37 AM.
|
|
|
|
|
|
#10 |
|
Senior Member
|
Just remember to check for Bounds.Max and Bounds.Min in the panel where you are overriding the plot.
|
|
|
|
|
|
#11 |
|
Junior Member
Join Date: May 2011
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
Nice example.... thanks Koganam
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drawing in Indicator panel | Tremblinghandtrader | Indicator Development | 4 | 04-27-2010 12:49 AM |
| Drawing Arrows and Text in Price or Indicator area | BobTN | Indicator Development | 12 | 02-28-2010 10:59 AM |
| Drawing a single dot in indicator panel | zacharydw00 | Indicator Development | 7 | 07-21-2009 03:22 PM |
| Chart Panel for Text Only | BillCh | General Programming | 3 | 04-22-2009 01:11 PM |
| Developing an indicator that displays only text in Panel 2 thru N | Jim W. | Indicator Development | 6 | 02-11-2009 07:01 AM |