Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Dot for Trade Indicator

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

    Draw Dot for Trade Indicator

    I have created an indicator that will draw a dot above or below a bar when a set of parameters are true. (Above or below depending on a buy or sell situation) I do this with an "If / Then" statement where the Then statement is the DrawDot() method.

    My issue is that when applied the chart only draws the dot for the last instance for each instead of all instances. Once the set of conditions becomes true again the previous dot is erased and a new dot is drawn. How do I leave all dots?

    Here's an example of what I have.
    Code:
    if (
    						SMA(5)[0] > SMA(5)[1]
    						&& SMA(5)[1] < SMA(5)[2]
    						
    						&& Rising(SMA(5))
    						&& Rising(SMA(20))
    						&& Rising(SMA(40))
    						
    						)
    						DrawDot("Trade Alert Buy", true, 0, High[0] + 5, Color.LawnGreen);
    					
    					if (
    						SMA(5)[0] < SMA(5)[1]
    						&& SMA(5)[1] > SMA(5)[2]
    						
    						&& Falling(SMA(5))
    						&& Falling(SMA(20))
    						&& Falling(SMA(40))
    						)
    						DrawDot("Trade Alert Sell", true, 0, Low[0] - 5, Color.Red);

    #2
    Hello BReal,

    Thanks for your post.

    The way to show all of the dots is to provide a unique tag name for each dot. Currently you are using the same name for each dot and the functionality of erasing previous and only showing current is expected.

    An easy way to create unique tag names is to add the CurrentBar to the tagname, for example:

    DrawDot("Trade Alert Buy"+CurrentBar, true, 0, High[0] + 5, Color.LawnGreen);

    When the dots are drawn, if you double click on one and look at the property you will see, for example, a name such as "Trade Alert Buy1189". meaning the dot is on bar # 1189.

    DrawDot: http://ninjatrader.com/support/helpG...7/?drawdot.htm
    CurrentBar: http://ninjatrader.com/support/helpG...currentbar.htm

    Comment

    Latest Posts

    Collapse

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