• 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 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
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by lavalampmj, Today, 05:25 PM
    0 responses
    1 view
    0 likes
    Last Post lavalampmj  
    Started by Antares66, Today, 05:19 PM
    0 responses
    2 views
    0 likes
    Last Post Antares66  
    Started by jmneto, Today, 05:18 PM
    0 responses
    2 views
    0 likes
    Last Post jmneto
    by jmneto
     
    Started by Bobbyj78, Today, 02:21 PM
    2 responses
    12 views
    0 likes
    Last Post bltdavid  
    Started by EnveousColnago, Today, 02:10 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Ariana  
    Working...
    X