• 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 rickyblah12, Today, 01:01 PM
          0 responses
          8 views
          0 likes
          Last Post rickyblah12  
          Started by dadarara, Today, 12:18 PM
          0 responses
          8 views
          0 likes
          Last Post dadarara  
          Started by joemiller, Today, 07:33 AM
          2 responses
          12 views
          0 likes
          Last Post joemiller  
          Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
          7 responses
          38 views
          0 likes
          Last Post DaveS
          by DaveS
           
          Started by claxxical, Yesterday, 10:00 PM
          0 responses
          13 views
          0 likes
          Last Post claxxical  
          Working...
          X