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 techgetgame, Today, 11:42 PM
          0 responses
          7 views
          0 likes
          Last Post techgetgame  
          Started by sephichapdson, Today, 11:36 PM
          0 responses
          1 view
          0 likes
          Last Post sephichapdson  
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,613 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Working...
          X