Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing only appears on the last occurence of the pattern

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

    Drawing only appears on the last occurence of the pattern

    Hi,

    First of all - I have no coding experience. I would like to modify existing indicator so that instead painting bars - it would place a Diamond below or above the bar.

    In this indicator I've located a place

    case 2:
    BarBrushes[1] = _Color;
    BarBrushes[0] = _Color;
    break;

    When I place a phrase: "Draw.Diamond(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);", above "break", Diamond actualy appears in correct spot but only on the last spot on the chart where the pattern occured. Meanwhile bars remained Painted for all the duration that is availalbe on the chart.
    How to make this Diamond to appear on all occurences on the chart instead of only the last one?

    Regards

    #2
    Hello Pabulon,

    Thank you for your post.

    The tag for a drawing object is a unique ID used to reference that specific drawing object. If you reuse the same tag, each time you call a drawing object the same drawing object will be referenced and the existing drawing object will be modified instead of a new object being created.

    For example, if you tag your drawing object “myTag”, each time you use “myTag” the same drawing object will be modified.

    To create a new drawing object, use a new unique string as the tag each time you call a Draw method. As an easy way to make a new string unique add ‘CurrentBar’ to the string.

    Help Guide: NinjaScript > Language Reference > Common > OnBarUpdate() > CurrentBar

    The code below will create a new red dot one tick below the low each time it is called.

    Code:
    Draw.Dot(this, "myTag" + CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red);
    Please let us know if you have any further questions. ​
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Wonderful advice, thank You very much.

      Is there a way of adding OutlineBrush in this single line:

      Code:
      Draw.Dot(this, "myTag" + CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red);
      because Brushes.Red only deals with the Area

      Comment


        #4
        Hello Pabulon,

        Dots and Diamonds do not take an outline brush parameter. They can only be drawn in with one single color, there is no way to specify a different color for the outline with these methods unfortunately.
        Gaby V.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Zek303, 10-20-2024, 06:17 PM
        4 responses
        63 views
        0 likes
        Last Post bltdavid  
        Started by jointkp1, Today, 01:11 PM
        0 responses
        8 views
        0 likes
        Last Post jointkp1  
        Started by warpinator, Today, 01:01 PM
        0 responses
        13 views
        0 likes
        Last Post warpinator  
        Started by C_Hardy, 11-28-2024, 05:44 PM
        9 responses
        66 views
        0 likes
        Last Post C_Hardy
        by C_Hardy
         
        Started by kellyboy, Today, 11:29 AM
        0 responses
        9 views
        0 likes
        Last Post kellyboy  
        Working...
        X