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

How to make objects drawn on charts unselectable and unmovable?

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

    How to make objects drawn on charts unselectable and unmovable?

    My indicators draw quite a few objects on charts. When I use mouse to move charts to the left or to the right, it is very likely the mosue is clicked on such an object and the object (line or text) gets moved instead of the chart being crolled. Only the later action is what I intend to do. When the objects get moved, I have to press "F5" to reload the indicators which is annoying. So is there a flag to mark those objects drawn on charts unmovable?

    In eSignal, the lines can be drawn by two sets of APIs: drawLine() and drawLineTool(). Only the lines drawn by the later can be selected and moved.

    - Clearpicks
    Last edited by clearpicks; 04-21-2008, 08:03 AM.

    #2
    Unfortunately not. We have this on our list for NT7 considerations yet. Thanks for your suggestion though.

    Comment


      #3
      Originally posted by clearpicks View Post
      My indicators draw quite a few objects on charts. When I use mouse to move charts to the left or to the right, it is very likely the mosue is clicked on such an object and the object (line or text) gets moved instead of the chart being crolled. Only the later action is what I intend to do. When the objects get moved, I have to press "F5" to reload the indicators which is annoying. So is there a flag to mark those objects drawn on charts unmovable?

      In eSignal, the lines can be drawn by two sets of APIs: drawLine() and drawLineTool(). Only the lines drawn by the later can be selected and moved.

      - Clearpicks
      Is there a way to do this in NT8? I have a similar issue, in that I am drawing a bunch of things with a script, and occasional moving the chart, selecting that indicator drawn object is somewhat annoying.

      I know this isn't the NT8 forum, but figured I'd post it here before creating a whole new thread.

      Comment


        #4
        Hello forrestang,

        Thank you for your note.

        Drawing tools used within a script may be locked using the IsLocked property in NinjaTrader 8. When true, this will lock the drawing tool in question in place on the chart. Here's a link to our help guide that goes over this:



        And here's a quick example that draws an ArrowUp under every bar where the close has been greater than the open for the last three bars. If you try to move the chart arrows, you'll be unable to do so:

        Code:
                private ArrowUp myArrow;
                protected override void OnStateChange()
                {
                    if (State == State.SetDefaults)
                    {
                        Description                                    = @"Enter the description for your new custom Indicator here.";
                        Name                                        = "TestLockDrawObjects";
                        Calculate                                    = Calculate.OnBarClose;
                        IsOverlay                                    = true;
                        DisplayInDataBox                            = true;
                        DrawOnPricePanel                            = true;
                        DrawHorizontalGridLines                        = true;
                        DrawVerticalGridLines                        = true;
                        PaintPriceMarkers                            = true;
                        ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                        //Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                        //See Help Guide for additional information.
                        IsSuspendedWhileInactive                    = true;
                    }
                    else if (State == State.Configure)
                    {
                    }
                }
        
                protected override void OnBarUpdate()
                {
                    if (CurrentBar < 3)
                        return;
        
                    if(Close[0] > Close[1] && Close[1] > Close[2] && Close[2] > Close[3])
                    {
                        myArrow = Draw.ArrowUp(this, "myArrow" + CurrentBar, true, 0, Low[0] - (2 * TickSize), Brushes.Aquamarine);
                        myArrow.IsLocked = true;
                    }
                }
        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by forrestang View Post
          Is there a way to do this in NT8? I have a similar issue, in that I am drawing a bunch of things with a script, and occasional moving the chart, selecting that indicator drawn object is somewhat annoying.
          If you're sure you never want to interact with the object at all..
          Rather than just locking the object so it would not move..

          Using Kates answer above.. You could change
          Code:
          myArrow.IsLocked = true;
          to this instead.. and it will prevent any interaction
          Code:
          myArrow.IgnoresUserInput = true;[LEFT][COLOR=#4D4D4D][FONT=Helvetica][/FONT][/COLOR][/LEFT]



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

          Comment


            #6
            Originally posted by -=Edge=- View Post

            If you're sure you never want to interact with the object at all..
            Rather than just locking the object so it would not move..

            Using Kates answer above.. You could change
            Code:
            myArrow.IsLocked = true;
            to this instead.. and it will prevent any interaction
            Code:
            myArrow.IgnoresUserInput = true;[LEFT][COLOR=#4D4D4D][FONT=Helvetica][/FONT][/COLOR][/LEFT]



            Thanks a TON!! That is exactly what I needed.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            23 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            22 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X