Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can global draw object be updated from code?

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

    Can global draw object be updated from code?

    Hello,

    A few years ago I made an indicator that adds a toolbar to change the properties of draw objects. Color, size, style of line etc. It had the limitation of only updating objects within the chart. Changes made to global objects would not be reflected in other charts, only the chart the change was made. I managed to find a workaround that applied changes globally, but some of the changes only applied if the object was moved around in the chart. Thus triggering a position update would force all charts to notice the change in color, size etc.

    Has NinjaTrader8 added an official method to update the properties of global objects from code?

    Best regards,

    Unsuitable
    Ocean Trading Indicators
    Unsuitable
    NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

    #2
    Hello Unsuitable,

    Thank you for your post.

    The behavior is still set to only make the change on the chart where the script is applied; for example, if you use the foreach loop in the "Looping through the collection to find specific draw objects" example from this page within an indicator, the global lines will change to Brushes.Black only on the charts where the indicator is applied:


    If you are working with NinjaScript-drawn objects, in order to make a change that takes place globally you could save the object's properties, then call RemoveDrawObject(), then finally re-draw the desired object with the desired properties. This would replace the object with a new one drawn programmatically and the properties would be put into place globally.
    Otherwise, if you are working with a toolbar that detects user-drawn objects and wants to make a change, as a workaround you could set the IsVisible property to false for the user-drawn objects (this just sets them to be removed from charts visually, but they would still exist and be listed in the Drawing Tools window) and then re-draw the object programmatically so that the properties are put into place globally. For each desired change via either approach, you could then RemoveDrawObject() for any NinjaScript-drawn objects and replace them with a new one that has the change in property (or properties). For more information:



    You could determine if IsVisible needs to be set to false if IsUserDrawn is true:


    Please let us know if we may be of further assistance.

    Comment


      #3
      Hello Emily,

      In this case, the objects are drawn by the user or using the regular tools. So the draw object would be attached to the chart and not the indicator.

      It sounds like an official way to call a refresh of globally drawn objects has not been added yet. Could you add a vote for a "Force Refresh of Global Objects" feature (or whatever it would be called)?

      Best regards,

      Unsuitable
      Ocean Trading Indicators
      Unsuitable
      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

      Comment


        #4
        Originally posted by Unsuitable View Post
        Hello Emily,

        In this case, the objects are drawn by the user or using the regular tools. So the draw object would be attached to the chart and not the indicator.

        It sounds like an official way to call a refresh of globally drawn objects has not been added yet. Could you add a vote for a "Force Refresh of Global Objects" feature (or whatever it would be called)?

        Best regards,

        Unsuitable
        Ocean Trading Indicators
        Thanks for your feedback.

        I have submitted your interest in this feature request to the Development Team and will follow up with the internal tracking number for your reference as soon as it is created (or as soon as your vote is added in the case that this is an existing request).

        Thanks in advance for your patience.

        Comment


          #5
          Hello,

          For reference, I did come up with a solution to update objects globally. The indicator cycles through all available chart windows, then tabs, and then tag IDs. If it finds a match it updates the properties. That's a lot of back and forth from an indicator perspective. Also, the changes are only partially made, pressing F5 resets the global object to its original state. Whatever the internal global collection of objects is did not accept or see the change, only the charts' visual components.

          Ideally, Ninja would have a list of global objects and any changes made by an indicator would automatically trigger an update. Or Ninja would have a ForceGlobalRefresh() method. That could be inefficient. Perhaps in conjunction with a global draw object collection list, the code would call onto all draw objects of it self to update its containing charts. Which would look like the following

          Code:
          if (objectReference.IsGlobalDrawingTool)
            objectReference.GlobalForceUpdate(); --> All draw objects of that reference find its containing chart and update its changes.
          
          Alternatively, simply the method only without checking if it is global first. The method itself will check for that. If it's not is will skip over the method and continue with the rest of the code
          objectReference.GlobalForceUpdate();
          Anyway, those are some ideas.
          Unsuitable
          NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

          Comment


            #6
            Hello Unsuitable,

            Thanks for your patience and the other ideas..

            Your vote has been added to the feature request with ID SFT-4438. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

            When a feature request is implemented, you'll find a description of the new feature in the release notes:Thank you for using NinjaTrader.​

            Comment


              #7
              Hello Emily,

              Was there any GlobalForceUpdate() method added? The method I used does work, but would prefer an official method.

              Best regards,

              Unsuitable
              Unsuitable
              NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

              Comment


                #8
                Hello Unsuitable,

                SFT-4438 has not been implemented at this time.

                Please note, we receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing, so we cannot offer an ETA or promise of fulfillment.

                When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number may be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

                Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Chelsea,

                  The method to update objects globally broke but was fixed with objectFromGlobalChart.ForceRefresh().

                  For now that works but refreshing the chart reverts back all the changes. I poked around with setting the draw state of the object to building then back to normal to no avail. Do you have any ideas how to trick Ninja into realizing the properties have changed? Visually all the global objects did change but the refresh negates that. If the object is moved around then the changes become permanent.

                  Best regards,

                  Unsuitable
                  Unsuitable
                  NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  599 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  344 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  558 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  557 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X