• 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.


No announcement yet.

Partner 728x90


Custom indicator to click 2 points

  • Filter
  • Time
  • Show
Clear All
new posts

    Custom indicator to click 2 points

    I have my algorithm done for my indicator and everything works except letting the user click from point 1 to point 2. What I need is to click on Point A then Click Point B.
    What I need is to create 2 anchor points. I think I will create a drawing tool or it can be an indicator. Where can I find some code in order to create 2 anchor points?

    OK now I have another question is, would it better to create a drawing tool? If so how do one get an x value from a timestamp for the vector or is there an easy way to convert

    Draw.Ray(this,"Line125" ,tPointA,dPointA,tPointBDrawTime,dPointB,Brushes.O live,DashStyleHelper.Dash,2);

    to a drawing object?

    the 2 scenarios would be, create a CTRL hot key in order to get my 2 anchors OR create a drawing object. The algo is ready as an indicator at this point in time.
    Last edited by ballboy11; 03-16-2019, 11:39 AM.

    Hello ballboy11,

    Needing user interaction to click between two points sounds like a drawing tool.

    Is this indicator meant to work even if the user does not click on two points?

    Does the action or rendering only take place after the two points are selected?

    Any anchors in an indicator would need to be custom developed by you.

    You can get an x value from a timestamp with GetXByTime().

    Draw.Ray() is already a drawing object. Are you asking if you can make a copy of this?

    Chelsea B.NinjaTrader Customer Service


      Draw Ray will not work in drawing indicators. so the question is what is the alternative of a ray in a drawing indicator. If not I can use it as an indicator. I want to know if there is a hot key for example to use for click for point a and another hot key for click for point b?
      Lastly get x by time will that work for future time that has not been on the chart?


        Hello ballboy11,

        Indicators can call Draw.Ray() or any other drawing object.

        Attached is a working example.

        However, I'm not understanding how this is related to clicking points on a chart.

        Clicking on a chart and creating indicators with an indicator would require custom code and custom anchors / selection points.

        Anchors are native to Drawing tool scripts and are not native to Indicator scripts.
        Attached Files
        Chelsea B.NinjaTrader Customer Service


          The misunderstanding is :

          option#1 use an indicator and create a hot key to create an anchor, a button event or a hotkey event and use a ray.
          My algotrithm is done and only need to create 2 anchors for this scenario.

          Option#2 create a drawing tool script. Drawing tool scripts can not use Draw.Ray. What is the alternative of Draw.Ray? Secondly can one get an x Value ahead of current market time such as ie a week in advance?
          The algorithm can work here but how do you draw a ray in a drawing tool script?


            Hello ballboy11,

            Creating custom anchors in an indicator would be outside of what is supported by NinjaTrader Support.

            It would also be unsupported, but entirely possible, to trigger a drawing object to be manually activated.

            Drawing tools are not able to call more drawing tools.

            Your drawing tool would need to replicate the behavior of the ray tool.
            Chelsea B.NinjaTrader Customer Service


            Latest Posts


            Topics Statistics Last Post
            Started by Swing123, Today, 03:09 AM
            0 responses
            Last Post Swing123  
            Started by Antares66, Yesterday, 05:19 PM
            1 response
            Last Post NinjaTrader_ChrisSch  
            Started by lavalampmj, Yesterday, 05:25 PM
            0 responses
            Last Post lavalampmj  
            Started by jmneto, Yesterday, 05:18 PM
            0 responses
            Last Post jmneto
            by jmneto
            Started by Bobbyj78, Yesterday, 02:21 PM
            2 responses
            Last Post bltdavid