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 muratb35, Today, 03:36 AM
          0 responses
          3 views
          0 likes
          Last Post muratb35  
          Started by fernlicht, Today, 02:16 AM
          2 responses
          11 views
          0 likes
          Last Post fernlicht  
          Started by fernlicht, 04-12-2021, 06:01 PM
          1 response
          28 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by memonolog, Today, 02:10 AM
          3 responses
          8 views
          0 likes
          Last Post memonolog  
          Started by orenytz, Today, 12:25 AM
          0 responses
          9 views
          0 likes
          Last Post orenytz
          by orenytz
           
          Working...
          X