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

Hide Indicator Drawn Chart Objects

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

    Hide Indicator Drawn Chart Objects

    I have a couple of indicators that draw a large number of Drawing Objects (HorizontalLines, VerticalLines and Text).

    Is it possible to hide the Drawing Objects drawn by these indicators in the Drawing Objects dialogue? Ideally I only want to see objects that have been drawn manually.

    Thanks,
    Greg
    The Trading Mantis
    NinjaTrader Ecosystem Vendor - The Trading Mantis

    #2
    Hello,

    Thank you for the post.

    This is actually possible now in NT8 using the drawing objects menu.

    If you Right click the chart and choose Drawing Tools -> Drawing Objects
    In the menu that opens, you can highlight all tools at once by either pressing Control + A after clicking on one of the tools in the list or using the Control or shift + click command.

    Once selected you should see a limited set of options on the right which includes "Visible", just uncheck that and they should disappear after clicking OK.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,
      I was actually wanting to do the opposite... show drawn objects on the Chart and hide the objects in the Drawing Objects dialogue.

      I would like to just see the manually drawn objects in the dialogue, so it is easy to find and delete them.
      The Trading Mantis
      NinjaTrader Ecosystem Vendor - The Trading Mantis

      Comment


        #4
        Hello,

        Thank you for the clarification.

        In that case, that would not currently be possible. All objects will be listed in this dialog if they are attached to the chart where the dialog was opened. I will put in a feature request for some way to toggle the display of script drawn objects from being on the list.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks Jesse,

          An alternate feature request, that should be easier to implement, is to sort all the objects in the Drawing Object dialogue list by tag. I think they are currently sorted in the order they are loaded/rendered on the chart.

          With this sort, I could tag my indicator drawn objects appropriately (e.g. preface the tag with a "+" sign) and then easily find the manually drawn objects.

          This sort would also group all like objects together and all global objects together, which would be very convenient.
          The Trading Mantis
          NinjaTrader Ecosystem Vendor - The Trading Mantis

          Comment


            #6
            Quite old post, but I want to share how I solved this requirement.

            I solved this by drawing in OnRender instead of OnBarUpdate. Then in OnRender, only draw if the related bar is visible at the moment. Save the drawn objects in a global list and remove all drawings before starting to redraw visible ones.
            By doing this, you only see visible drawings in "Drawing Objects" dialogue.

            Create a global list:
            Code:
            public class MyIndicator: Indicator
            {​
              private List<DrawingTool> m_DrawObjects;
              ...
            Initialize the list:
            Code:
            protected override void OnStateChange()
            {
              if (State == State.SetDefaults)
              {​
                 ...
                 m_DrawObjects = new List<DrawingTool>();
              }


            Given, that you have a series holding your reason to draw a marker (LongSignal + ShortSignal)
            OnRender:
            Code:
            protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
              m_DrawObjects.ForEach(obj => RemoveDrawObject(obj.Tag));
              m_DrawObjects.Clear();
            
              for (int i = chartControl.PrimaryBars.FromIndex; i <= chartControl.PrimaryBars.ToIndex; i++)
              {
                var valueLong = LongSignal.GetValueAt(i);
                var shortValue = ShortSignal.GetValueAt(i);
            
                if (valueLong > 0)
                {
                  var low = Low.GetValueAt(i-1);
                  var time = Time.GetValueAt(i-1);
                  var obj = Draw.ArrowUp(this, "Long" + i, true, time, low - TickSize * 10, Brushes.Green);
                  m_DrawObjects.Add(obj);
                }
                else if (shortValue > 0)
                {
                  var high = High.GetValueAt(i-1);
                  var time = Time.GetValueAt(i - 1);
                  var obj = Draw.ArrowDown(this, "Short" + i, true, time, high + TickSize * 10, Brushes.Red);
                  m_DrawObjects.Add(obj);
                }
              }
            
              base.OnRender(chartControl, chartScale);
            }​
            BR
            TheAngryCube

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GLFX005, Today, 03:23 AM
            0 responses
            1 view
            0 likes
            Last Post GLFX005
            by GLFX005
             
            Started by XXtrader, Yesterday, 11:30 PM
            2 responses
            11 views
            0 likes
            Last Post XXtrader  
            Started by Waxavi, Today, 02:10 AM
            0 responses
            6 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by TradeForge, Today, 02:09 AM
            0 responses
            14 views
            0 likes
            Last Post TradeForge  
            Started by Waxavi, Today, 02:00 AM
            0 responses
            3 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Working...
            X