• 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

How to 'recognize' drawn arrows in code

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

    How to 'recognize' drawn arrows in code

    Hi everyone

    I have no idea how to go about this but I have a feeling this may be possible.

    What I'd like to have is some code that would detect all arrows drawn manually on a chart (and then, for example, calculate the distance to the next close, something like this).

    Any ideas would be much appreciated.

    #2
    Hi arbuthnot,

    To find all arrows on a chart.

    foreach(IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.ArrowDown)
    {
    IArrowDown dArrow;
    dArrow = (IArrowDown) draw;
    if (dArrow == null)
    return;
    Print(dArrow.Y);
    }
    }

    Once you have two objects you can use the Y or Time and do your subtraction.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much, Chelsea, for telling me this is possible and how to go about it.

      I'll try to set this up as an indicator over the next day or two. If I have nay further questions about this, I'll post back here.

      Much obliged.

      Comment


        #4
        Originally posted by arbuthnot View Post
        Thanks very much, Chelsea, for telling me this is possible and how to go about it.

        I'll try to set this up as an indicator over the next day or two. If I have nay further questions about this, I'll post back here.

        Much obliged.
        You asked specifically for manually drawn objects, so you are missing a filter.
        Code:
        ...
        if (draw.DrawType == DrawType.ArrowDown && draw.UserDrawn){//...}

        Comment


          #5
          Originally posted by koganam View Post
          You asked specifically for manually drawn objects, so you are missing a filter.
          Code:
          ...
          if (draw.DrawType == DrawType.ArrowDown && draw.UserDrawn){//...}
          Much obliged, Koganam! I'll incorporate your code.

          Cheers.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by hincal, Today, 10:07 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_RyanS  
          Started by MIKEALV1975, Yesterday, 07:30 AM
          4 responses
          17 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by shawn9876, Today, 09:07 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by pvtrader, Today, 09:51 AM
          5 responses
          17 views
          0 likes
          Last Post pvtrader  
          Started by andreslazor7, Today, 08:28 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Working...
          X