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 alifarahani, Today, 09:40 AM
          2 responses
          12 views
          0 likes
          Last Post alifarahani  
          Started by junkone, Today, 11:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by pickmyonlineclass, Today, 12:23 PM
          0 responses
          1 view
          0 likes
          Last Post pickmyonlineclass  
          Started by frankthearm, Yesterday, 09:08 AM
          12 responses
          44 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by quantismo, 04-17-2024, 05:13 PM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X