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

Modifying the Line Tool

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

    Modifying the Line Tool

    Hey there,

    I would like to Modify the Line tool so that if I hold shift when I draw a line, it will restrict it to horizontal... I don't want it to span the whole screen like the built-in horizontal line.

    Is this possible?

    Thanks,

    Kev

    #2
    Hello reach4thelasers,

    Thank you for your post.

    You could create a custom drawing tool that was the same as the Line with this function. You can look into the Lines Drawing Tools code by going to the NinjaTrader Control Center > New > NinjaScript Editor > double click on the Drawing Tools folder > double click on the Lines file.

    For information on Drawing Tools in NinjaScript please visit the following link: http://ninjatrader.com/support/helpG...wing_tools.htm

    Please let me know if you have any questions.

    Comment


      #3
      Thanks Patrick found what I needed and its working great.

      I've attached the modified line tool. Hold shift and draw and line and it will snap to horizontal. You should consider adding this change to Trunk its a great feature enhancement.
      Attached Files

      Comment


        #4
        Hello reach4thelasers,

        Thank you for posting your edit.

        Please let me know if you have any questions.

        Comment


          #5
          Originally posted by ludopuig
          One question: Is mandatory to create a custom drawing tool, same as the Line plus this function, or is it possible to change the Line code instead?

          Thanks!
          Hello ludopuig,

          Thank you for your response.

          While it would not be recommended, you can in fact edit the Lines.cs file if you wished to do so.

          Please let me know if you have any questions.

          Comment


            #6
            Would someone be so kind to code this for NT7?

            Thank You


            Originally posted by reach4thelasers View Post
            Thanks Patrick found what I needed and its working great.

            I've attached the modified line tool. Hold shift and draw and line and it will snap to horizontal. You should consider adding this change to Trunk its a great feature enhancement.

            Comment


              #7
              Hello geotabs,

              Thank you for your response.

              Custom drawing tools through NinjaScript were not supported in NinjaTrader 7.

              Please let me know if you have any questions.

              Comment


                #8
                Hello InTheMoment,

                The posted modification applies changes to OnMouseDown. This code is shared between Lines and Rays. If you would like to have this work for while you are first drawing the object, you could move this code in OnMouseMove. Another approach to consider would be to add your own keyboard events and check that the DrawingState is IsEditting on that keyboard event.

                Adding your own Keyboard events would be a general C# approach that would not specifically be NinjaScript.

                Please let us know if we can be of further assistance.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Is there any updates on this? I got this working on my laptop but my install on my desktop it wont work.. I replaced the @Lines.cs file in the bin/custom/drawingtools folder but it still won't snap horizontally when holding shift and drawing a line

                  Comment


                    #10
                    Hello zachiatrist,

                    reach4thelasers has not posted any additional modifications to the script in post #3.

                    We are tracking interest in having similar behavior added to drawing tools so they snap horizontally/vertically when pressing Shift/Control with the ticket ID SFT-2546. I have added a vote on your behalf. We collect interest in feature requests before determining if the feature should be implemented. For that reason we cannot offer an ETA or promise of fulfillment. Upon implementation, the number for the ticket ID can be publicly found in the Release Notes page of the help guide. I will provide a link below.

                    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                    Please let us know if you have any questions.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      How do I add this cs file to the Nintatrader? Thanks

                      Comment


                        #12
                        Welcome to the forums tradetheBTC!

                        This DrawingTool is a modification of the Documents\NinjaTrader 8\bin\Custom\DrawingTools\@Lines.cs DrawingTool. You can drop the user's modification here and replace the standard NinjaTrader version.

                        After that version is dropped in you will need to recompile NinjaScripts. (Control Center > New > NinjaScript Editor > Press F5 to Compile.) I recommend taking this step before importing the modified CS file to ensure the platform is compiling before manually importing this modified script.

                        You may also wish to ask the user who created the modification if they can provide an export for a new DrawingTool, since any updates to the platform will overwrite this system indicator.

                        We look forward to assisting.

                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by reach4thelasers View Post
                          Thanks Patrick found what I needed and its working great.

                          I've attached the modified line tool. Hold shift and draw and line and it will snap to horizontal. You should consider adding this change to Trunk its a great feature enhancement.
                          How to add this tool to NT8 ? I relly need this feature..

                          Comment


                            #14
                            Hello kzelisko,

                            Below is a link to an example of a custom line drawing tool.


                            To import a NinjaScript into NinjaTrader 8 do the following:
                            1. Download the script to your desktop, keep it in the compressed .zip file.
                            2. From the Control Center window select Tools -> Import -> NinjaScript...
                            3. Click the Desktop icon on the left to navigate to the desktop
                            4. Select the downloaded .zip file -> then click Open
                            5. NinjaTrader will then confirm if the import has been successful.
                            Critical *Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.

                            Below is a link to the help guide on importing.
                            https://ninjatrader.com/support/help...-us/import.htm
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by yertle, Today, 08:38 AM
                            4 responses
                            13 views
                            0 likes
                            Last Post yertle
                            by yertle
                             
                            Started by bill2023, Yesterday, 08:51 AM
                            6 responses
                            27 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
                            80 responses
                            19,667 views
                            5 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by adeelshahzad, Today, 03:54 AM
                            3 responses
                            16 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by dappa, Today, 09:18 AM
                            1 response
                            6 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Working...
                            X