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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        173 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        91 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        129 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        208 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        186 views
        0 likes
        Last Post CarlTrading  
        Working...
        X