Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Objects on First Instance Only

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

    Draw Objects on First Instance Only

    Dear Support,

    I can not find any reference on "How to draw only the first instance of a draw object."

    For Example: The condition "Draw.ArrowUp if Both Price and RSI are rising" will draw arrows on every successive bar that meets the condition. However, we are interested only in the first arrow until the condition no longer exists and the the condition exists again.

    Any reference or example scripts please?

    Many thanks.
    .

    #2
    Hello,

    if the arrow is being plotted on each bar, that likely would mean you are using a unique Tag name like "Tag" + CurrentBar

    To limit a drawing you would need to use a non unique tag like "MyTag" but this would update an existing object if the condition remains true.

    To limit this to the first occurrence only, you would likely need a bool variable. When the drawing is added, set the bool variable to true. You would also need to surround the drawing with a condition to check if the bool variable is true. This would limit the drawing to once when it becomes true the first time and not after. You could reset the bool variable when you want this logic to work again.

    Code:
    if(myBool == false)
    {
        Draw.Dot(...);
        myBool = true;
    }
    
    if(someConditionToReset)
        myBool = false;
    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    331 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X