• 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 Venom, Today, 01:05 PM
          0 responses
          5 views
          0 likes
          Last Post Venom
          by Venom
           
          Started by Dert66, Today, 12:11 PM
          0 responses
          6 views
          0 likes
          Last Post Dert66
          by Dert66
           
          Started by jjanguda, Today, 10:04 AM
          0 responses
          223 views
          0 likes
          Last Post jjanguda  
          Started by sambo81, Today, 09:20 AM
          1 response
          12 views
          0 likes
          Last Post sambo81
          by sambo81
           
          Started by TopGunNote, 05-14-2019, 01:12 PM
          3 responses
          81 views
          0 likes
          Last Post dpaulw
          by dpaulw
           
          Working...
          X