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

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().



    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.



            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 bmartz, 03-12-2024, 06:12 AM
            4 responses
            32 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            12 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by cls71, Today, 04:45 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X