• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 PG7940, Today, 04:26 AM
        0 responses
        2 views
        0 likes
        Last Post PG7940
        by PG7940
         
        Started by marcus2300, Today, 02:25 AM
        0 responses
        2 views
        0 likes
        Last Post marcus2300  
        Started by drpapp, 01-24-2019, 06:57 AM
        5 responses
        69 views
        0 likes
        Last Post pjsmith
        by pjsmith
         
        Started by plydcv, Today, 12:40 AM
        0 responses
        3 views
        0 likes
        Last Post plydcv
        by plydcv
         
        Started by Sh00tHerMcGavin, Yesterday, 07:39 PM
        0 responses
        4 views
        0 likes
        Last Post Sh00tHerMcGavin  
        Working...
        X