Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show global draw objects

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

    Show global draw objects

    Hi,

    I asked for this a while ago as a feature request, but I would like to just build it myself now as I would find it really useful and the long way around is bugging me as I use it a lot.

    I want to switch 'show global draw objects' on and off from an icon on the chart tool bar. When I click the series icon and unselect show global draw objects, then click OK, it happens _without_ reloading all the data etc, which is perfect. I am assuming it simply turns off a variable and on the next onRender, the chart drawings are simply not displayed. So, my question is, is this flag/variable publicly exposed in any way so I can set it, and what is it ?

    Many thanks.

    #2
    Originally posted by pjsmith View Post
    I want to switch 'show global draw objects' on and off..
    Code:
    foreach(var v in DrawObjects.ToList().Where(x => x.IsUserDrawn && x.IsGlobalDrawingTool))
    {
         v.IsVisible = !v.IsVisible;
    }
    this.ForceRefresh();


    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    Comment


      #3
      Good Morning, and thank you very much, Edge!

      I had looked at something similar, but does this however set the visible flag for the drawing object, preventing it showing on all charts? I think when I looked at it in the past, it did, and I ended up drawing duplicate objects etc. I'm looking to simply hide them briefly off a single chart, so I can see a clean chart - essentially replicating the 'show global draw objects' toggle, but, I think, without setting all the draw objects to invisible. Pretty sure this must be a single flag for the chart currently being used, rather than a change to the drawing objects themselves.

      Comment


        #4
        Originally posted by pjsmith View Post
        does this however set the visible flag for the drawing object, preventing it showing on all charts?
        No...

        In my opinion it should.. yes.. but because of the way global objects current work.. NO..
        Regretfully changing a property of a global object on any chart, will only effect that chart..



        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #5
          Aha! Thanks very much. Off to try this now... Have a great day and enjoy your weekend

          Comment


            #6
            Hello pjsmith,

            Through testing, the Drawing Object will still be visible on other charts. Moving the Drawing Object on another chart will make the it visible on the chart where the script is applied.

            You could consider looping through all windows/charts and then through the chart's ChartObject's collection to accomplish the task. This is not documented/supported code, but should be enough to get you moving in the right direction.

            Code:
            foreach (var window in NinjaTrader.Core.Globals.AllWindows)
            {
                //check if the found window is a Chart window, if not continue looking
                if (!(window is NinjaTrader.Gui.Chart.Chart)) continue;
            
                window.Dispatcher.InvokeAsync(new Action(() =>
                {
                    //try to cast as a Chart, if it fails it will be null
                    var foundChart = window as NinjaTrader.Gui.Chart.Chart;
                    if (foundChart == null) return;
            
                    foreach (NinjaTrader.Gui.NinjaScript.IChartObject obj in foundChart.ActiveChartControl.ChartObjects.ToList())
                    {
                        var foundObj = obj as DrawingTool;
            
                        if (foundObj == null) continue;
            
                        if (foundObj.IsUserDrawn && foundObj.IsGlobalDrawingTool)
                        {
                             foundObj.IsVisible = !foundObj.IsVisible;
                             foundObj.ForceRefresh();
                        }
                    }
                }));
            }
            We look forward to assiting.
            JimNinjaTrader Customer Service

            Comment


              #7
              Thank you Jim - I have a working concept based on the earlier suggestion, but will try this over the weekend too. It's a remarkably good tool, IMO!

              Comment


                #8
                There, isn't that much better, easier?

                Comment


                  #9
                  #PJ, please share the love....
                  Then, if I ever get NT8 to work consistently reliably after two years at the task, and stop finding new expected behaviours aka bugs/design idiocy, I can risk using your third-party add-on to provide basic platform functionality and remove the need for at least one chart per instrument from my overly complex workspace

                  Comment


                    #10
                    LOL. Let me test it a little bit to make sure I do not make your situation worse, and I will send it to you

                    Comment


                      #11
                      ...and if I could switch from a Minute-based chart to a Second-based chart in the same tab without screwing everything up, like NT7 used to, I could reduce my overly complex workspace chart count by half! And platform-induced performance issues would be a thing of the past. Fantasy.
                      Test away, won't be adding any time soon.

                      By way of update, my setup is coping with current environment very well.


                      Well, except Alerts which are still unreliable.
                      Last edited by brucerobinson; 03-09-2020, 07:41 AM.

                      Comment


                        #12
                        Hello brucerobinson,

                        If you are having an issue setting up an alert, please open a new thread for a technician to assist you with how it should be set up.

                        We look forward to assisting.
                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Jim View Post
                          Moving the Drawing Object on another chart will make the it visible on the chart where the script is applied.
                          hmmm.. I had not noticed that before.. Reloading NinjaScript also brings back.. not ideal!

                          Previously there was no way of setting the "Show Global Draw Objects" property via script..

                          Has this possibly changed?


                          -=Edge=-
                          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                          Comment


                            #14
                            Originally posted by brucerobinson View Post
                            ...and if I could switch from a Minute-based chart to a Second-based chart in the same tab without screwing everything up, like NT7 used to, I could reduce my overly complex workspace chart count by half!
                            Just a thought, but how about just overlaying your min bars over your seconds bars..
                            I realize you don't do 3rd Party Stuff.. but as an idea, something like this:




                            -=Edge=-
                            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                            Comment


                              #15
                              Hello Edge,

                              ShowGlobalDrawingObjects can be set to false from ChartBars.Properties, but as the Help Guide mentions, this is intended for user interaction and is not always guaranteed to be set programmatically.

                              ChartBars.Properties.ShowGlobalDrawObjects = false;

                              ChartBars.Properties - https://ninjatrader.com/support/help...properties.htm

                              We look forward to assisting.
                              JimNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              436 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post FAQtrader  
                              Started by rocketman7, Today, 09:41 AM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X