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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        82 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        43 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Working...
        X