Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting an arrow on all bars of chart

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

    Getting an arrow on all bars of chart

    Hi programmers,

    I'm trying to get an arrow drawn on all bars of my chart, not just the recent. So far, I was able to get it done for the most recent. I'm trying to get the arrows to be shown for all conditions that were satisfied on the entire chart.
    How can I do that?

    This is what I have in my UpDateBar function

    if(CrossAbove(SMA(movingAverage1) , SMA(movingAverage2), 1)){

    DrawArrowUp("Long", true, 0, Low[0] - TickSize, Color.Green);
    }

    if(CrossBelow(SMA(movingAverage1) , SMA(movingAverage2), 1)){

    DrawArrowDown("Short", true, 0, High[0] + TickSize, Color.Red);
    }

    Thanks so much

    #2
    Originally posted by BernWillChris View Post
    Hi programmers,

    I'm trying to get an arrow drawn on all bars of my chart, not just the recent. So far, I was able to get it done for the most recent. I'm trying to get the arrows to be shown for all conditions that were satisfied on the entire chart.
    How can I do that?

    This is what I have in my UpDateBar function

    if(CrossAbove(SMA(movingAverage1) , SMA(movingAverage2), 1)){

    DrawArrowUp("Long", true, 0, Low[0] - TickSize, Color.Green);
    }

    if(CrossBelow(SMA(movingAverage1) , SMA(movingAverage2), 1)){

    DrawArrowDown("Short", true, 0, High[0] + TickSize, Color.Red);
    }

    Thanks so much
    You'll need to add something to the tag as each draw object needs a different one. The most common way of doing this is:

    DrawArrowUp("Long" + CurrentBar, true, 0, Low[0] - TickSize, Color.Green);

    Comment


      #3
      Hello BernWillChris,

      Thank you for writing in. Arbuthnot is correct, you will need to add a unique identifier to the arrow tag. Otherwise the program will continuously redraw the two arrows "Long" and "Short" on the current bar instead of creating new arrows on the current bar.

      More information on the DrawArrowDown() method can be found here: http://ninjatrader.com/support/helpG...warrowdown.htm
      and more information on the DrawArrowUp() method can be found here: http://ninjatrader.com/support/helpG...rawarrowup.htm

      Please let us know if you have any further questions.
      Michael M.NinjaTrader Quality Assurance

      Comment


        #4
        Thanks so much!

        I figured that out shortly after posting it and didn't get to deleting the post before y'all were so generous to reply.

        Thanks again.

        Comment


          #5
          Hello BernWillChris,

          Thank you for the update. I am glad to hear you were able to resolve the issue.

          Please let us know if you have any questions anytime.
          Michael M.NinjaTrader Quality Assurance

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by toughiee, Today, 12:04 AM
          0 responses
          2 views
          0 likes
          Last Post toughiee  
          Started by vdoan20, Yesterday, 08:30 PM
          0 responses
          7 views
          0 likes
          Last Post vdoan20
          by vdoan20
           
          Started by gupagoer, Yesterday, 07:42 PM
          0 responses
          9 views
          0 likes
          Last Post gupagoer  
          Started by Holligoly, Yesterday, 05:13 PM
          2 responses
          11 views
          0 likes
          Last Post Holligoly  
          Started by Raginpower, Yesterday, 01:53 PM
          0 responses
          14 views
          0 likes
          Last Post Raginpower  
          Working...
          X