• 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

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 pstrusi, Today, 02:05 PM
          0 responses
          1 view
          0 likes
          Last Post pstrusi
          by pstrusi
           
          Started by Seastragg, Today, 01:21 PM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by stafe, Today, 01:27 PM
          0 responses
          3 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by Dagamos, Today, 11:48 AM
          2 responses
          13 views
          0 likes
          Last Post Dagamos
          by Dagamos
           
          Started by kantkant2, Yesterday, 03:20 PM
          4 responses
          25 views
          0 likes
          Last Post eDanny
          by eDanny
           
          Working...
          X