![]() |
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: Oct 2009
Location: Australia
Posts: 108
Thanks: 2
Thanked 14 times in 7 posts
|
I'd like my indicators to draw behind the Price bars & not in front.
Is there a way to set this? NB: I do understand that the order I draw my indicators will implicitly set the zOrder. Similarly if I override the PLOT method the order that I use the graphics.Fill & graphics.Draw will also be "last drawn goes on top". |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
David, welcome to the forums, zOrder support will be added with our upcoming NinjaTrader 7 version - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html
New Chart Object Paint Ordering (z-order) As you select any object on a chart, hold down the SHIFT key and scroll with your mouse wheel, you can change the paint layer of the selected object in order to move it in front of or behind other drawn objects. In the image below, the rectangle is selected and is currently on "Level 5 of 5" meaning, it is at the very bottom of the paint order. You could scroll your mouse wheel to "Level 1 of 5" which would put the rectangle on top of all others objects.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
|
Bertrand, can we control ZOrder programmatically in NT7 with our indicators?
Last edited by jdfagan; 12-16-2009 at 01:45 PM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
A single indicator has only one zorder. Any objects drawn from the indicator share the same z-order stacking as the indicator itself.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
|
Understood, I want to control ZOrder amongst many indicators living on same Chart Panel via code.
For example, using your StrategyPlot capability from a strategy, I can add and control many indicators for that strategy. Using the ZOrder property (e.g., StrategyPlot(0).ZOrder) doesn't seem to work). Only way I can control is by order of when I add an indicator - last one added seems to have top-most ZOrder.
Last edited by jdfagan; 12-16-2009 at 01:45 PM.
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Right. Unfortunately you cant control it by code other than the order in which you are adding it.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Certified NinjaScript Consultant
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
|
When an indicator draws a trendline, that trendline is always painted UNDER the price bars.
What do we use (programmatically) to push those drawn trendlines to ride on top of the price bars? Thanks, Ben |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Ben, in NT7 you can control the ZOrder of the drawn objects by the SeparateZOrder property.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Certified NinjaScript Consultant
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
|
I see that in the ILine...but the SeparateZOrder property is a boolean value. I assume once you set it to true (meaning you want to separate the ZOrder of that element)...you then have to set the ZOrder numerically (somehow) so that it rides on top of the chart bars?
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Ben, you can't set it programmatically - setting this property to true allows you to control the ZOrder of the draw object then manually, see my attached example.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Certified NinjaScript Consultant
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
|
Ok...thanks for the info. So once the line is drawn to the chart (and programmatically set SeparateZOrder = true), then the user will be able to manually change the ZOrder via the scroll-wheel interface.
That answers my question! Thanks again |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Yes, exactly - you open the line's ZOrder up to be independent from the applied indicator, thus it gets it's own ZOrder level on the chart.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
|
Are you saying that it will be impossible to programmatically control whether my indicator will be blotted out by price candles? Please find a fix for this as it would be nonsense trying to tell users/customers to manually adjust after applying an indicator to a chart! The end result needs to be user friendly as the very least. Thanks for any consideration.
|
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Oct 2007
Posts: 1,829
Thanks: 12
Thanked 83 times in 67 posts
|
Just have a few questions:
(1) ZOrder can be used in the Initialize section of an indicator. What values can ZOrder take? If I set ZOrder = -1, will this draw my indicator behind the candles? What happens if two indicators use ZOrder = -1? (2) I understand that I can separate the ZOrder of different draw objects within an indicator as per post #10 below. (3) I understand that a workspace saves the ZOrder manually selected, have tested this -> ok. (4) However, I found that a chart template will not save the ZOrder. To solve this issue, two solutions are possible - modify NT7 to include ZOrder with chart templates - hardcode the ZOrder within the indicator This comes back to the first question. Can I attach different values for ZOrder in the Initialize() section of an indicator to define the plot order? |
|
|
|
|
|
#15 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Harry, unfortunately setting the direct ZOrder level programmatically is not supported. To avoid conflicting ZOrder level settings, we would advise adjusting your layout as needed and then saving this in a workspace.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SNAP to price on indicators | ssierra | Suggestions And Feedback | 4 | 07-01-2010 09:18 AM |
| ATM not putting target and stop when not connected? | badasan | ATM Strategies (Discretionary Trading) | 12 | 08-21-2009 03:11 PM |
| Putting indicator thread to sleep | grose | Indicator Development | 1 | 02-26-2009 11:21 AM |
| ATM strategy 7x14tick putting Stop order with 0 contracts | devinb | ATM Strategies (Discretionary Trading) | 5 | 01-16-2009 10:37 AM |
| Putting OutputWindow messages into log file | xewoox | General Programming | 1 | 12-04-2008 09:03 AM |