Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IText.BarsAgo

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

    IText.BarsAgo

    In NT7 IText had a property BarsAgo. Is there a replacement for it with the new Text class?

    #2
    All draw objects will have some sort of "ChartAnchor" field which exposes this information, rather than a field directly on the interface/object itself.
    e.g.,
    Code:
    Text myText = Draw.Text(this, "tag", "test", 0, High[0]);
    Print(myText.Anchor.BarsAgo); // the barsAgo value passed to the method
    Print(myText.Anchor.DrawnOnBar); // the actual current bar
    MatthewNinjaTrader Product Management

    Comment


      #3
      I meant to also mention that the implementation of barsAgo has changed, if you need the number of actual bars that have passed since the current bar, you need to calculated that from .DrawnOnBar

      Code:
      Print(CurrentBar - myText.Anchor.DrawnOnBar);
      MatthewNinjaTrader Product Management

      Comment


        #4
        Hi Matthew,
        I use to be able to just set the BarsAgo property (say to -1) on a Text object to get it to move to the end of the chart on the x-axis after every new bar. I assumed this was more efficient than deleting the old one and creating a new one. How would I do that with the new drawing objects?

        Comment


          #5
          Hello,

          Probably the most efficient way to go about this would be to simply redraw the text. You could call Draw.TextFixed() once more, using the same tag as the previously drawn text, to overwrite the existing instance with a new position.
          Dave I.NinjaTrader Product Management

          Comment


            #6
            Originally posted by GrumpyTrader View Post
            Hi Matthew,
            I use to be able to just set the BarsAgo property (say to -1) on a Text object to get it to move to the end of the chart on the x-axis after every new bar. I assumed this was more efficient than deleting the old one and creating a new one. How would I do that with the new drawing objects?
            Hmm, works here...

            Draw.Dot(this, "tag", false, -1, High[0], Brushes.Blue);

            What chart setup, method, indicator settings, etc are you using?

            What is it currently doing instead of moving to the next bar?
            MatthewNinjaTrader Product Management

            Comment


              #7
              If you meant on the IDrawingTool object, you can use the Time[0] property

              Code:
              		protected override void OnBarUpdate()
              		{			
              		  if(State.Historical == State)
              			 myText = Draw.Text(this, "tag", "Test", 5, High[0], Brushes.Blue);
              			
              		  else if(myText != null)
              			myText.Anchor.Time = Time[0];
              			
              		}
              MatthewNinjaTrader Product Management

              Comment


                #8
                Thanks, setting the time works perfectly. Lastly, I'm not sure if it is a bug, but for some reason when using the Ray object the intellisense doesn't show you the Tag property even though it is there.

                Comment


                  #9
                  Hi GrumpyTrader,

                  I was able to confirm that Tag is not in the intellisense list for IDrawingTools.

                  You can use this, and it will compile if you do, but its not in the list.

                  I appreciate you reporting this issue.

                  I have submitted a bug report about this to development. Please let me know if you find any other issues in NT8 you would like to report.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cre8able, Today, 01:16 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post cre8able  
                  Started by chbruno, 04-24-2024, 04:10 PM
                  3 responses
                  48 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by samish18, Today, 01:01 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_LuisH  
                  Started by WHICKED, Today, 12:56 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by WHICKED, Today, 12:45 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X