Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X