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

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 futtrader, 04-21-2024, 01:50 AM
          4 responses
          41 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          11 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          3 views
          0 likes
          Last Post port119
          by port119
           
          Started by Philippe56140, Today, 02:35 PM
          0 responses
          4 views
          0 likes
          Last Post Philippe56140  
          Started by 00nevest, Today, 02:27 PM
          0 responses
          2 views
          0 likes
          Last Post 00nevest  
          Working...
          X