thanks on any input on this
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
drawing on multiple panels from within an indicator
Collapse
X
-
drawing on multiple panels from within an indicator
I wondered what the best way if possible to draw on the main price panel 1 from a loaded indicator. So i have an indicator in a lower panel which mostly draws on that panel i would like to include instances within the indicator code to additionally draw on the panel 1 ie change candle / bar colours. I recall there was flexibility in the drawing to be able to reference different drawing regions/panels but not clear on this.
thanks on any input on thisTags: None
-
Hello,
There are two ways to approach this question. Strictly speaking, there is not a way to place drawing objects on multiple panels at once at this time. You can use the DrawOnPricePanel property to draw on the price panel if your indicator resides on a separate panel, but that would not allow you to draw on the indicator panel at the same time.
That being said, it sounds like you are actually looking for a way to change properties of bars in a separate panel, and that can be done. The key is to check through the ChartObjects in the appropriate index of the ChartControl.ChartPanels collection, then change the ChartStyle properties within that ChartPanel, like so:
Code:foreach(Gui.NinjaScript.IChartObject obj in ChartControl.ChartPanels[0].ChartObjects) { if(obj.Name.ToString() == "ChartBars") { ChartBars cb = obj as ChartBars; cb.Properties.ChartStyle.Stroke.Brush = Brushes.Blue; } }
Dave I.NinjaTrader Product Management
-
Hello, thank for the reply. How i managed this in NT7 was to have 2 versions of an indicator - one which draws in the indicator panel and another which utilises similar logic but the drawing is applied to the main panel. I was hoping there was a way to circumvent loading essentially 2 albeit slightly different instances of an indicator.
In your example above this would change the color/brush / wick whichever aspect of the bars for the entire bar range - is it possible to isolate the Current bar / using Current bar or a time range (which i would include in the logic) or index via the if ( idx != LastBarIndexPainted ) - as illustrated in the link you sent. ie so that only certain bars properties would change given a qualifying test.
thanks
Comment
-
Originally posted by NinjaTrader_Dave View PostI will post back soon with info on changing individual bar properties.Dave I.NinjaTrader Product Management
Comment
-
Hello, i wondered if it is my best bet in the interim to create custom chart style / bar type or if this is to be how this is handled going forward - ie no way to reference panel id where drawing/rendering to take place? I will take a look at the Brush collection for the bar colours.
Also can you take a look at the Drawing link in the NT8 help page - to me it is misleading as in footnote 1 it implies the capability to draw on both panels is available and possible though does not give example of how to do so.
thanks
Comment
-
Originally posted by soulfx View PostHello, i wondered if it is my best bet in the interim to create custom chart style / bar type or if this is to be how this is handled going forward - ie no way to reference panel id where drawing/rendering to take place? I will take a look at the Brush collection for the bar colours.
Also can you take a look at the Drawing link in the NT8 help page - to me it is misleading as in footnote 1 it implies the capability to draw on both panels is available and possible though does not give example of how to do so.
thanks
Comment
-
Originally posted by soulfx View PostAm using both Draw.<object> and the OnRender methods in the OnRender override.
Does it make a difference if one set is used and the OnRender is not depending on the Windows OS version?
ref: http://ninjatrader.com/support/forum...31428#poststop
- Likes 1
Comment
-
Thank for note, interesting they have not indicated this when i asked the question and would be good if Ninja could confirm if this is/will be supported or remain unsupported in NT8. Good trick to be aware of and will try out in NT7.
The other question i posted was related to the DirectX in another thread as to how this would be supported for Windows OS pre version 8 as directX SDK is available in windows 8 onwards and how this would be handled for windows 7 etc installations.
thanks for tip
Comment
-
Originally posted by soulfx View Post...
The other question i posted was related to the DirectX in another thread as to how this would be supported for Windows OS pre version 8 as directX SDK is available in windows 8 onwards and how this would be handled for windows 7 etc installations.
thanks for tip
ref: http://sharpdx.org/about/features
Comment
-
Yes, the technique of dynamically setting DrawOnPricePanel will still be valid in NinjaTrader 8. Keep in mind again that this applies to NinjaScript Drawing Tools, not to SharpDX drawing methods (those called on RenderTarget). Also, keep in mind that this allows you to dynamically draw on either the price panel or the indicator panel, which means it will not, for example, allow you to draw a single object spanning multiple panels, or allow drawing in any panel other than those specific two.
You should be fine to run on Windows 7, as it falls into the minimum system requirements listed at the link below:
http://ninjatrader.com/support/helpG...n-us/?beta.htm
That being said, please let us know if you start running into DirectX errors, so that we can investigate further.Dave I.NinjaTrader Product Management
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
5 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
3 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
7 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM |
Comment