• 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

DrawArrowUp/Down only displays one set

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

    DrawArrowUp/Down only displays one set

    Hi:

    I would like to see the Up and Down arrows each time there is a change in direction. Yet, only the last set displays on the Chart (see attached pic).

    The print statement shows the logic is working; just the drawing does not.

    I've attached the program.

    Also, how can I make the Arrows larger (fatter)?

    Thanks in advance.
    Attached Files
    Last edited by ronhb107; 04-06-2016, 04:07 AM.

    #2
    Hello ronhb107,

    Thanks for your post and welcome to the forums!

    All draw objects (like DrawArrowUp and DrawArrowDown) use a tag name to identify the object. When you use a non changing tag name only the most current object is drawn. What happens is that if the new arrow tag name matches an existing one on the chart, the existing one is removed because each tag name must be unique (otherwise there would be no way for Ninjascript to know which is which).

    If you check the helpuide in any draw method, take a note of the description of the parameter tag: "A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

    To be able to show all arrows drawn you would need to create a unique tag name for each arrow drawn. A common way to do this is to modify the tag name with the value of the current bar (assuming you only have 1 arrow per bar). For example "Up"+CurrentBar would yield a tag unique tag name like Up2167. Here is one of your statements: DrawArrowUp("Up"+CurrentBar, false, 0, Low[0] - (2 * TickSize), colorUp);
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      DrawArrowUp/Down only displays one set

      Thank you, Paul. That works!

      Is there any way to enlarge the arrow (to really make it stand out)?
      Last edited by ronhb107; 04-06-2016, 07:48 AM.

      Comment


        #4
        How can you keep each new DrawText per bar that occurs? When I use +CurrentBar it resets to the latest location on that current bar when the new condition is met. I need it to draw text as many times as the condition is met for that bar..

        DrawText("block1"+CurrentBar, true, "" +e.Volume,0,e.Price,0,Color.White, ChartControl.Font, StringAlignment.Center, Color.Black, Color.Black,7);

        Thanks.

        Comment


          #5
          Originally posted by brucelevy View Post
          How can you keep each new DrawText per bar that occurs? When I use +CurrentBar it resets to the latest location on that current bar when the new condition is met. I need it to draw text as many times as the condition is met for that bar..

          DrawText("block1"+CurrentBar, true, "" +e.Volume,0,e.Price,0,Color.White, ChartControl.Font, StringAlignment.Center, Color.Black, Color.Black,7);

          Thanks.
          Use an incrementing counter as a suffix to the tag.

          Comment


            #6
            Hello brucelevy,

            Thanks for your post.

            If you are using CalculateOnBarClose = false and you wish to see each arrow drawn intrabar then as member koganam has advised you would need an additional way of ensuring that you have unique tag names intrabar. Certainly using a counter will provide that. You would want to reset the counter on the first tick of each bar. For example (variable "counter" would be declared as an integer):

            if (FirstTickOfBar)
            {
            counter = 0; // set/reset counter to 0 on first tick of the new bar
            }


            In your draw text code:

            if (some condition)
            {
            DrawText("block1"+CurrentBar+counter, true, "" +e.Volume,0,e.Price,0,Color.White, ChartControl.Font, StringAlignment.Center, Color.Black, Color.Black,7);
            counter++;
            // increment counter
            }
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by uiwislth, Yesterday, 11:25 PM
            0 responses
            4 views
            0 likes
            Last Post uiwislth  
            Started by Steve L, Yesterday, 10:04 PM
            0 responses
            3 views
            0 likes
            Last Post Steve L
            by Steve L
             
            Started by marianfed, Yesterday, 09:47 PM
            0 responses
            5 views
            0 likes
            Last Post marianfed  
            Started by hir04068, Yesterday, 09:29 PM
            0 responses
            4 views
            0 likes
            Last Post hir04068  
            Started by iq200, 03-11-2018, 07:49 PM
            24 responses
            1,022 views
            0 likes
            Last Post mrlucky1x  
            Working...
            X