Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,768 views
    0 likes
    Last Post Leafcutter  
    Started by Rapine Heihei, 04-23-2024, 07:51 PM
    2 responses
    30 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    943 views
    0 likes
    Last Post spwizard  
    Started by Max238, Today, 01:28 AM
    0 responses
    9 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by rocketman7, Today, 01:00 AM
    0 responses
    7 views
    0 likes
    Last Post rocketman7  
    Working...
    X