Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot() method in NT8 ???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • -=Edge=-
    replied
    Originally posted by neoikon View Post
    Do you have any code examples you can share to accomplish what you have in that pic? For example, shading between plots, all the Profile stuff, etc? Thanks!
    Sorry, I don't really have any simple examples, that's actually a proprietary indicator of mine, and the profile stuff although very doable, does tend to get a bit complicated..

    Although you could look at the default VolumeZones and VolumeProfile indys that come in NT8 to spark some idea's and possibly get you started in the right direction..


    Leave a comment:


  • foobar
    replied
    Originally posted by ninZa View Post
    Thanks. There are a lot of new things to learn

    What about the toolbar? Is it still ToolStrip, with which we can get the toolbar as:

    toolStrip = (ToolStrip)ChartControl.Controls["tsrTool"];

    Thank you.
    Pi
    There is a new cool NT8 way to do this. AddOns:
    http://ninjatrader.com/support/helpG...dowcreated.htm

    Here is my first AddOn:

    Code:
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.NinjaScript.Indicators;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows;
    using System.Windows.Automation.Peers;
    using System.Windows.Automation.Provider;
    using System.Windows.Controls;
    using System.Windows.Media;
    
    public class MyWindowAddOn : AddOnBase
    {
        private NTMenuItem myMenuItem;
        private NTMenuItem existingMenuItem;
    
        protected override void OnWindowCreated(Window window)
        {
            foreach (Button btn in FindVisualChildren<Button>(window))
            {
                if (btn != null && btn.HasContent && btn.Content is string)
                {
                    var text = btn.Content.ToString();
                    if (text == "OK")
                    {
                        btn.Content = "_" + btn.Content;
                        btn.IsDefault = true;
                    }
                    if (text == "Cancel")
                    {
                        btn.Content = "_" + btn.Content;
                        btn.IsCancel = true;
                    }
                    if (text == "Apply")
                    {
                        btn.Content = "_" + btn.Content;
                    }
                }
            }
        }
    
        public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
        {
            if (depObj != null)
            {
                for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
                {
                    DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
                    if (child != null && child is T)
                    {
                        yield return (T)child;
                    }
    
                    foreach (T childOfChild in FindVisualChildren<T>(child))
                    {
                        yield return childOfChild;
                    }
                }
            }
        }
    }
    note the "FindVisualChildren" method from here:
    http://stackoverflow.com/questions/9...window-by-type

    VisualTreeHelper seems to be the key to WPF.

    Code:
    foreach (NTMenuItem item in FindVisualChildren<NTMenuItem>(window))
    {
    }

    Leave a comment:


  • neoikon
    replied
    Originally posted by -=Edge=- View Post
    @MBScalper
    everything to the right of the bars here in this pic was done in the now OnRender override.
    Do you have any code examples you can share to accomplish what you have in that pic?

    For example, shading between plots, all the Profile stuff, etc?

    Thanks!

    Leave a comment:


  • ninZa
    replied
    Originally posted by -=Edge=- View Post
    To be honest, when I'm stuck I just do a yahoo search.. But tend to like both of these sites..

    www.codeprojects.com
    www.stackoverflow.com

    both provide great references for any number of things.. not just wpf..

    just an example
    http://www.codeproject.com/Articles/...s-with-answers

    Thanks Edge
    I also find useful articles at http://www.wpf-tutorial.com

    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by lawyse View Post
    Were those VWAP line plots and opacity fill between the upper and lower line plots were also done in OnRender? Thanks!
    All the lines to the left of the bars are plots, but all the labels to the right of the bars for the plots were done in OnRender.. That particular region was not done in the OnRender yet, but working towards moving it and the others there yes.. Don't want to get to far ahead of myself incase more code breaking changes come with next beta's..


    Leave a comment:


  • -=Edge=-
    replied
    Originally posted by ninZa View Post
    Hi Edge,

    Can you recommend some good webpages on the net for us to learn WPF ourselves?

    Thank you very much.
    Pi
    To be honest, when I'm stuck I just do a yahoo search.. But tend to like both of these sites..

    www.codeprojects.com
    www.stackoverflow.com

    both provide great references for any number of things.. not just wpf..

    just an example
    http://www.codeproject.com/Articles/...s-with-answers

    Leave a comment:


  • lawyse
    replied
    Were those VWAP line plots and opacity fill between the upper and lower line plots were also done in OnRender? Thanks!

    Originally posted by -=Edge=- View Post
    @MBScalper
    Without quoting your post, the short answer is YES.. Everything you can do in NT7 you can do in NT8 and/or more/better/easier (just different)! Conversions of most indicators won't be a real difficult process! EXCEPT for those that were implementing the PlotOverride.. That part is completely and totally different in almost every aspect! For me, because I used this method extensively, that part has been the hardest and both a daunting and exhaustive process! Both from a learning curve on my part, and the actual conversion itself. (mainly due to my lack of knowledge and ignorance in this area, as well as the lack of current documentation at the moment) (although I'm sure that is to come, and there are several code example references all over the place inside the platform).. But to ease your mind and others, everything to the right of the bars here in this pic was done in the now OnRender override.

    But if your inexperienced like myself in WPF, and using this technique, get ready for a brand new learning curve, and some extensive rework of existing code!

    Initially in the short term here you might be thinking that's a bummer.. BUT Long Term, WOW!.. This new structure is going to open up a whole new world of ideas, capabilities, and development for the NinjaTrader Community!!!

    Leave a comment:


  • ninZa
    replied
    Hi Edge,

    Can you recommend some good webpages on the net for us to learn WPF ourselves?

    Thank you very much.
    Pi

    Leave a comment:


  • MBScalper
    replied
    Thank you Edge for taking the time to reply to my post and thank you for the reassurance. The attached Chart does make me help me feel better about things. This does look like you can set margins, text size, draw custom shapes etc. through OnRender even without the graphics object.

    I have programmed in many languages over the years as part of my job but only started programming in C# about 8 months ago so I am very new to the C# thing. Despite this I have learned a lot and developed things in NT that I could only have dreamed about developing on other platforms. I hope to pick up new knowledge and move my work to NT8 when possible.

    No doubt, WPF is the direction the platform should go. Maybe someone will be kind enough as the beta gets underway to produce a WPF introduction document for those familiar with custom development in NT7. I look forward to the public beta release so that I can start transitioning.

    Thanks again

    Leave a comment:


  • -=Edge=-
    replied
    @MBScalper
    Without quoting your post, the short answer is YES.. Everything you can do in NT7 you can do in NT8 and/or more/better/easier (just different)! Conversions of most indicators won't be a real difficult process! EXCEPT for those that were implementing the PlotOverride.. That part is completely and totally different in almost every aspect! For me, because I used this method extensively, that part has been the hardest and both a daunting and exhaustive process! Both from a learning curve on my part, and the actual conversion itself. (mainly due to my lack of knowledge and ignorance in this area, as well as the lack of current documentation at the moment) (although I'm sure that is to come, and there are several code example references all over the place inside the platform).. But to ease your mind and others, everything to the right of the bars here in this pic was done in the now OnRender override.

    But if your inexperienced like myself in WPF, and using this technique, get ready for a brand new learning curve, and some extensive rework of existing code!

    Initially in the short term here you might be thinking that's a bummer.. BUT Long Term, WOW!.. This new structure is going to open up a whole new world of ideas, capabilities, and development for the NinjaTrader Community!!!

    Attached Files

    Leave a comment:


  • MBScalper
    replied
    Plot Override

    NinjaTrader,

    I originally posted this on the BigMikeTrading site and was advised that I should post on the NT Forum instead so hopefully I have found the right place. I am not part of the closed group involved in the Beta Test so I will wait for others to work out solutions if this question is too early. I hope my points prompt thoughts or answers from others.

    Q) I know there is going to be a new way of drawing objects on the screen in NT8. Is there however going to be a some way we can access similar Plot Override functionality along with the Graphics Object?
    I have about 12000 lines of a partially completed project where I have used this NT7 functionality extensively. It would be nice if there was some way to use this functionality and make the job of porting our work a little easier.

    I am getting the horrible feeling from reading the little info available that I am looking at another learning curve and possibly a complicated rewrite.
    In essence, All my calculations are done in the On Bar Update Section. I use Plot Override to simply to render drawing objects to the screen. I would have stayed with the built-in NT7 Ninjascript commands if I hadn't met a number of limitations along the way.

    Thanks in advance for the response.

    Answer from NT so far.
    This level of question is best suited for the NinjaTrader 8 section of our own support forum. That being said, NT7 uses Winforms while NT8 for charts uses DirectX hosted in WPF window. My point is the technologies are completely different for those doing custom rendering.
    I understand that the technologies are different but... can the same type of feature made available to help with at least a speedy transition?
    Maybe I just need to find some tutorials / introduction materials on WPF in relation to NinjaTrader.
    One example of why I use Plot Override in NT is to do with scaling (dynamic shrinking and expanding) of text (above / below Price bars) and drawing objects (e.g. synthetic bars) on the screen when I increase or decrease the number of price bars displayed.
    Regards,

    Leave a comment:


  • ninZa
    replied
    In NT8 charts, the toolbar already occupies most of the space, so we have to add a new separate toolbar below it for custom toolbar buttons.

    Leave a comment:


  • ninZa
    replied
    Originally posted by koganam View Post
    Yes, this will be most welcome. It appears that you are using a new API, SharpDX, with no direct exposure of a graphics object/context to grab for standard c# graphics. It is wreaking havoc with most of my Custom Plots, especially, any such that I use to display a table.

    If it comes to the worst, I may have to resort to subscribing to the PaintEventHandler, and running my Plots from there.
    NT8 breaks so many things
    But we can always think about paint events as the last resort.

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    I see - if you can send me an example of some of the issues you've experienced, I can see if I can streamline a solution in the context of SharpDX. [email protected] or PM will work for any custom scripts if needed.

    For what it is worth, the SuperDOM Columns gives you a standard WPF DrawingContext you can use to render custom grids/tables (albeit our documentation is lacking here as well). I'm sure this does not help for your indicators, but could be worth looking into.

    Leave a comment:


  • koganam
    replied
    Originally posted by NinjaTrader_Matthew View Post
    @SampleCustomPlots and @BarTime should be distributed in your custom\indicator folder. Let me know if not and I can PM them to you (we'd also want to know where they went!)

    I'd also suggest you guys take a look over the DrawingTools and ChartStyles, as they demonstrate a great deal of interacting with OnRender() with SharpDX, as well as native chartControl/chartScale elements.

    Custom chart rendering is next up on our list to complete for the NT8 documentation. Your experiences are very welcome at this time.
    Yes, this will be most welcome. It appears that you are using a new API, SharpDX, with no direct exposure of a graphics object/context to grab for standard c# graphics. It is wreaking havoc with most of my Custom Plots, especially, any such that I use to display a table.

    If it comes to the worst, I may have to resort to subscribing to the PaintEventHandler, and running my Plots from there.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by ezrollin, Yesterday, 08:12 PM
9 responses
91 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by fscabrera03, Yesterday, 07:14 PM
1 response
62 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by mbrandau, Yesterday, 05:33 PM
1 response
67 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by RT001, Yesterday, 05:19 PM
2 responses
61 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by salaksi1, Yesterday, 04:48 PM
1 response
66 views
0 likes
Last Post NinjaTrader_ChelseaB  
Working...
X