Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Transform User Drawn Drawing To Be Global From Drawing Code

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

    Transform User Drawn Drawing To Be Global From Drawing Code

    Is there any way to change a user drawn drawing from local to global from the drawing code?

    For example, I would like to add something like a simple context menu item to toggle between global and non-global (its the action not the menu item that I am looking for).

    I can change IsGlobalDrawingTool, but that does not have any affect. You can also change the attachedTo, again no joy.

    I am aware that this can be done by going to properties and changing the attached to property, but this does not work for the intended use model. Somehow need to get the current drawing onto the list of global drawing objects.

    Any help would be appreciated.

    #2
    Hello aslane,

    Thanks for your post.

    IsGlobalDrawingTool is read only, but if you look into DrawingTool NinjaScript overloads, you can get a hint for how this is set programmatically with DrawingTool.SetDrawingToolCommonValues. This method is not documented, so there would not be any direction we can share other than making you aware of it, but you could try something like the following:

    Code:
    foreach (DrawingTool draw in DrawObjects.ToList())
    {
        DrawingTool.SetDrawingToolCommonValues(draw, draw.Tag, draw.IsAutoScale, this, true);
    }
    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      IsGlobalDrawingTool actually has a get and set, but the set does not do what would be expected (that could be a nice feature request to allow that to work properly to toggle drawing back and forth between global and local).

      I am aware of the code you mentioned, but it generally does not work from say a context menu for a current drawing. Perhaps I am missing some nuance.

      I can create a new drawing and replace the current one, but that seemed a little heavy handed. Perhaps that is the Ninja way.

      Comment


        #4
        Hello aslane,

        I have given this an attempt from a ContextMenu and I have not been able to flip the properties of the current draw object in this fashion. Since the suggested method is not documented/supported, I do not have any further insight I can share if a viable solution can be achieved.

        If other community members want to give it a try, I do have a DrawingTool example that adds context menus that can be used to get started for testing. If a community member finds a solution, please reply back here with your findings.

        https://ninjatrader.com/support/foru...g-tool-example

        In the meantime, I have submitted a vote to our feature request tracking interest to support NinjaScript ability to set drawing objects as global. The ticket ID is SFT-948. This is an internal number, but for anyone else wishing to have their interest tracked, please let our support staff know that you would like a vote added for this request.

        Feature Request Disclaimer

        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.

        When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will 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

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        22 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X