Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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[COLOR="Blue"] && draw.UserDrawn[/COLOR]){//...}

        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[COLOR="Blue"] && draw.UserDrawn[/COLOR]){//...}
          Much obliged, Koganam! I'll incorporate your code.

          Cheers.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by benmarkal, Yesterday, 12:52 PM
          3 responses
          22 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by helpwanted, Today, 03:06 AM
          1 response
          16 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          11 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          6 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          244 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Working...
          X