• 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

Custom indicator to click 2 points

Collapse
X
  • 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, 12:39 PM.

    #2
    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().
    https://ninjatrader.com/support/help...getxbytime.htm


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

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      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?

      Comment


        #4
        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

        Comment


          #5
          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?

          Comment


            #6
            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.
            https://ninjatrader.com/support/foru...695#post777695


            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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jjnc2006, Today, 07:36 PM
            0 responses
            4 views
            0 likes
            Last Post jjnc2006  
            Started by futurenick, Today, 06:26 AM
            1 response
            11 views
            0 likes
            Last Post nkhoi
            by nkhoi
             
            Started by NinjaCustomer, Today, 12:29 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by Steve L, Today, 11:32 AM
            0 responses
            7 views
            0 likes
            Last Post Steve L
            by Steve L
             
            Started by prabbala, Today, 10:41 AM
            0 responses
            4 views
            0 likes
            Last Post prabbala  
            Working...
            X