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 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 Kaledus, Today, 01:29 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by frankthearm, Yesterday, 09:08 AM
        13 responses
        45 views
        0 likes
        Last Post frankthearm  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        16 views
        0 likes
        Last Post PaulMohn  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        2 responses
        55 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Started by yertle, Yesterday, 08:38 AM
        8 responses
        37 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Working...
        X