• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

InsertComplete

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

    #16
    Using myCollectionChanged

    Here is a modified version of your code
    on this example when a dot is painted on the chart some of its detected settings are correct like its object type, tag name, color, but not its BarsAgo
    May be Im doing something wrong ?

    Thanks !
    Attached Files
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    Comment


      #17
      Are you manually adding the chart object, or is it NinjaScript drawn?

      ChartAnchor.BarsAgo is a NinjaScript property, which would only be set if NinjaScript object drew the object.

      Draw.Dot(this, "dot"+CurrentBar, false, 10, Close[0], Brushes.Blue);

      ChartAnchor.BarsAgo would be 10 in that example.

      If it is a manually drawn object, there is no barsAgo (i.e., what is the bars ago relative to at that point?).

      Instead, you can either get the ChartAnchor.Time or the ChartAnchor.DrawnOnBar.
      MatthewNinjaTrader Product Management

      Comment


        #18
        Thank you Matthew, that was the trouble...
        Thinking it was the same ( manually drawn than ninjascript drawn ) as on n7 with insertcomplete I was testing manually painting the objects...
        ...but through an indicator it works perfect



        but on manually drawn objects it looks like the position can not be retrieved
        Manually Drawn = True
        Bars Ago = -2147483648
        Time = 01-ene-00 00:00:01
        DrawnOnBar = -2147483648

        Print("Manually Drawn = " + x.IsUserDrawn ) ;
        foreach (ChartAnchor anchor in x.Anchors)
        {
        Print("Bars Ago = "+ anchor.BarsAgo);
        Print("Time = "+ anchor.Time);
        Print("DrawnOnBar = "+ anchor.DrawnOnBar);
        }

        I sometimes need to detect when a user paints or moves an object and also know that object chart location....is this possible ?
        Last edited by pmaglio; 10-26-2016, 04:10 PM.
        pmaglio
        NinjaTrader Ecosystem Vendor - The Indicator Store

        Comment


          #19
          The earliest the data you are looking for will be available will be during OnBarUpdate. You will need to use IDrawingTool.Tag and a method similar to the one I posted earlier, with a 1 tick series, to put this information where your event callbacks can get at them.

          I have attached an example where I have done this.

          The attached script will have populated ChartAnchors when an object is removed, but not when it is first added. This code and the sample Matthew posted earlier both act only when a drawing object is created or removed. You will have to use another event to determine whether a drawing tool was modified.

          The attached script also has a method which will tell you the string name (or hex value, if there isn't one) of a passed in brush. For example, if you send it a ForestGreen brush, it will return the string "ForestGreen", and if you send it an RGB FE, DC, BA brush, it will return "#FFFEDCBA" The first FF represents the opacity.
          Attached Files
          Jessica P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by thgamey, Today, 08:38 PM
          0 responses
          2 views
          0 likes
          Last Post thgamey
          by thgamey
           
          Started by johnnybegoode, Today, 07:02 PM
          0 responses
          4 views
          0 likes
          Last Post johnnybegoode  
          Started by YevhenShynkarenko, Today, 05:02 PM
          1 response
          11 views
          0 likes
          Last Post YevhenShynkarenko  
          Started by lahabatha, Today, 04:42 PM
          0 responses
          12 views
          0 likes
          Last Post lahabatha  
          Started by explorer101, Today, 03:39 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X