Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw a dot on the chart everytime a Condition is met

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

    Draw a dot on the chart everytime a Condition is met

    Hello everybody,

    at the moment i am working on a strategy, which has three different possibilities for exiting a current position. I am testing the strategy regularly with strategy analyzer.
    For comprehending issues i connected each one of the three different possibilities with Print(Possibility 1, 2, 3...)

    My goal is to mark the three different possibilities with draw.dot() in different colours directly on the chart, what would give me a far better overview.

    Unfortunately there was only the last exit marked. It seems draw.dot() only marks only one exit, but i want for each exit a dot (What would be a unknown number).


    Is there a solution for my little problem?
    I don´t necessary need a dot, i just need something on the chart, what shows me the reason for the exit.

    #2
    You need unique tag like this "YourDot"+CurrentBar. Because NT redraws your previous dot if new one has the same tag.
    Draw.Dot(this, "YourDot"+CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red);
    Last edited by Leeroy_Jenkins; 02-04-2021, 05:48 AM.

    Comment


      #3
      Hello debleded,

      Thanks for your post.

      Using Draw objects on the chart is a great way to debug.

      As forum member Leeroy_Jenkins advised, you need each drawing object to have a unique tag name. When you use the same tag name, the previous object with that tag name is removed from the chart and the new one is drawn and this is why you only see the latest. The CurrentBar is the systems bar counter so by adding +CurrentBar to the tag name you would create a unique tag per bar. In his example, if you looked at the tag name of the objects you would see something like YourDot1256 if the dot was on the 1256th bar.

      If you are using the Strategy Builder, you would click on the "tag name" field and it would show a "String Builder" window. In this window click "add" to add a new string line, next click "set" on that new line, in the "Value" window, open the Misc folder and select "Current bar", click OK, click OK, and click Ok when done with any other dot properties.

      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Thank you both @ Leeroy_Jenkins and PaulH!

        Quick and easy solution which works perfectly!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by t.kelly4149, Today, 05:36 PM
        1 response
        5 views
        0 likes
        Last Post bltdavid  
        Started by SilverSurfer1, Today, 06:29 PM
        0 responses
        15 views
        0 likes
        Last Post SilverSurfer1  
        Started by trader3000a, Today, 01:06 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by marcus2300, Today, 11:45 AM
        3 responses
        31 views
        0 likes
        Last Post marcus2300  
        Started by pel11, Today, 11:06 AM
        0 responses
        12 views
        0 likes
        Last Post pel11
        by pel11
         
        Working...
        X