![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
The following code won't draw the rectangle on tick charts.
protected override void OnBarUpdate() { DrawRectangle("tag1", 10, Low[10], 5, High[5], Color.PaleGreen, Color.PaleGreen, 2); } |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
I got rectangles to draw in my indicator. I can draw a rectangle on the price pane but it's bad, I have to scale things to fit the price range. I cannot get the same code to draw a rectangle in panel2... I added the line DrawOnPricePanel =false to the initializations but nothing draws on panel2. Panel2 just sits there with a scale of 0 to 1...
I can't get it to overlay on the price either. I assume that would take care of all the scaling work...
Last edited by maxpi; 06-17-2009 at 02:21 PM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You actually need something populating panel 2 if you want to draw in there. Please add a plot there and try again.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
It draws just vertical lines on panel2. They appear to be where the right and left edge of the rectangles are intended to be. They all have a height of 1 and the panel2 scale is 1. I can print the values at the time of generating the draw objects, they are not 1, ever..
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
I added in the plot by copy /paste from another indicator. It does not show up in the indicator properties as applied to the chart.. Can I fix that or is it necessary to step through the wizard and generate a new indicator?
|
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
maxpi,
You probably did not copy paste all the components down in the Properties region of the code.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
I've gone mucking about in the properties section before and had to reinstall the .net, no thanks on that idea.
The main problem I had was an assumption that the rectangle drew from left to right, I had the begin and end values reversed, it was drawing little vertical lines.... Anyhow, I have the indicator drawing rectangles on panel 2 but the scaling is a problem. I have a plot going because it is necessary. I don't really want to use the plot for anything. If I plot the same height as the rectangle, when I have the last tick on the right edge of the screen, the scaling is ok for the one rectangle that is visible at that point. If I scroll back such that the plot is not visible the scaling just becomes unity and all the rectangles have the same height... I've tried various combinations of booleans both in the indicator code, the Draw code, etc... and I just can't get that scale to be other than unity... If I don't plot, the scale is always unity.
Last edited by maxpi; 06-18-2009 at 10:17 AM.
|
|
|
|
|
|
#9 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
maxpi,
I am not sure what you mean by unity. Please try using a plot that will just set the scale to what you want all the time and then it should work?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
unity =1. The scale is zero to one except when the plotted value is shown. The entire code operates on realtime bars only, probably the plot scaling applies only to the most recent bar in that case... I have it plotting on the price panel now, I'll have to change the code to run on history bars to draw it on panel2 I'm sure..
ty |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Sorry not entirely following you. Just create a plot that actually has a usable scale and then you can draw on it.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
|
It all runs on realtime data only, that seems to be the crux of the matter, the scaling of panel 2 is ok only when the last tick is visible on the right edge of the screen... it draws ok now overlaying price but it really might be better if I could get it to plot in panel 2.. I'll try allowing it to run on historical data.
ty |
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
maxpi,
Not sure what you mean by "last tick showing". The scale should work regardless as long as there are data points. Please provide screenshots/examples. Thank you.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Draw a rectangle to group 3 bars | Winnie | Indicator Development | 1 | 03-31-2009 05:57 AM |
| Fancy Rectangle | pdavidow | Charting | 9 | 03-16-2009 09:04 AM |
| Rectangle question | 5iver | Charting | 2 | 11-01-2008 03:14 PM |
| Rectangle disappears | SteveB | Charting | 2 | 07-15-2008 08:51 AM |
| Draw tools that draw on multiple charts of the same instrument | cipher4d | Suggestions And Feedback | 3 | 04-19-2008 12:33 AM |