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

Draw Arrow help

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

    Draw Arrow help

    I'm unable to get my indicator to draw an arrow on the chart.

    This is the code that draws the arrow, I cannot get it to draw an arrow no matter where in the code I place the "draw arrow"
    Code:
    for(int i = minConsecutive - 1; i >= 0; i--)
    	{
    		if (High[i + 1] < High[i]
    			&& i != 0)
    			break;
    						
    		if (i == 0
    			&& CrossAbove(Close, High[1], 1))
    		{
    			Buy.Set(Close[0]);
    			DrawArrowUp(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Green);
    		}
    	}

    If anyone would like to see the whole code is attached.
    Attached Files

    #2
    For the first bar on your chart, you try to access High[i+1] with i = minConsecutive - 1, which means that you try to access High[minConsecutive] or High[3]. However, for the first bar of your chart a high 3 bars ago does not exist.

    Please insert the code

    Code:
    if(CurrentBar < minConsecutive)
        return;
    in the beginning of the region entry.

    Comment


      #3
      Thank you so much!

      Comment


        #4
        Hello,

        Harry is correct. You will want to ensure that you have enough bars data loaded on the chart for what you are using as your bars ago.

        http://www.ninjatrader.com/support/f...ead.php?t=3170
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,227 views
        0 likes
        Last Post xiinteractive  
        Started by andrewtrades, Today, 04:57 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        7 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        440 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        11 views
        0 likes
        Last Post FAQtrader  
        Working...
        X