Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing Straight Horizontal Vertical or 45 degree lines

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

    Drawing Straight Horizontal Vertical or 45 degree lines

    When drawing any lines using the drawing tool in NinjaTrader, one should be able to press and hold the SHIFT key on the keyboard after establishing the first anchor point, and draw across at the exact same horizontal level from that anchor point a perfect horizontal or vertical or some 45 degree angle as the mouse moves around on the screen. That mitigates the need to have to perfectly align the line manually. This is pretty much a standard in other solutions (Gimp, Word, MS Office, etc).

    Thx.

    #2
    Well... looks like the latest version 8.0.27.0 adds this feature. Thanks NinjaTrader!

    Comment


      #3
      Hello wildwex,

      Thank you for your post.

      If you have additional questions, please feel free to reach out. Happy Trading!
      Alaura Q.NinjaTrader Customer Service

      Comment


        #4
        Hello, it looks like this feature in the update is bugged. While holding shift and using the line tool (F2), the line stays straight until you let go and it snaps end anchor to where your mouse is. But if you re-try on the same line it stays the second time. Any explanation for this?

        Comment


          #5
          Hello ChrisR,

          Thank you for reaching out; glad to assist!

          I have tested this within my installation and I am unable to replicate this behavior as it appears to be working for me. Tested various settings that I thought may affect it and still no issue.

          Can you create a new workspace named ' Test ' > Open a single chart and test once again. If there is still an issue, please save the workspace and send it to us at support[AT]ninjatrader[DOT]com so we can test on our end.​

          Thank you for your use of NinjaTrader!
          Alaura Q.NinjaTrader Customer Service

          Comment


            #6
            This bug is happening for me as well. As soon as I click the second time to end the ray, it jumps up or down not allowing it to remain horizontal. This happens with snap mode on or off.

            Comment


              #7
              Hello electtriqtrading,

              Thank you for the response.

              Can you please create a new workspace named ' Test ' > Open a single chart and test once again. If there is still an issue, please save the workspace and send it to us at support[AT]ninjatrader[DOT]com so we can test on our end. and get your log and trace files.​

              Thank you for your use of NinjaTrader!​
              Alaura Q.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by electriqtrading View Post
                na
                Originally posted by NinjaTrader_Alaura View Post
                ​na
                There is an easy solution for this, on line 448 of the Lines.cs, you can add the following to check if shift is held during line editing, and update the end anchor to the start anchor if true. This solves the snap problem/bug and makes it true "shift to level". Since NT locks this .cs to read only, you will need to edit outside of NT in something like Visual Studio and save. Than open NT, go to editor and recompile the lines.cs through NT editor to get the change to load properly.

                Code:
                else if (EndAnchor.IsEditing)
                {
                      dataPoint.CopyDataValues(EndAnchor);
                      EndAnchor.IsEditing = false;
                
                      if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                      {
                            EndAnchor.Price = StartAnchor.Price;
                      }
                }​
                Last edited by ChrisR; 07-14-2023, 12:14 PM.

                Comment


                  #9
                  Originally posted by ChrisR View Post


                  There is an easy solution for this, on line 448 of the Lines.cs, you can add the following to check if shift is held during line editing, and update the end anchor to the start anchor if true. This solves the snap problem/bug and makes it true "shift to level". Since NT locks this .cs to read only, you will need to edit outside of NT in something like Visual Studio and save. Than open NT, go to editor and recompile the lines.cs through NT editor to get the change to load properly.

                  Code:
                  else if (EndAnchor.IsEditing)
                  {
                  dataPoint.CopyDataValues(EndAnchor);
                  EndAnchor.IsEditing = false;
                  
                  [COLOR=#3498db]if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                  {
                  EndAnchor.Price = StartAnchor.Price;[/COLOR]
                  }
                  }​

                  Hi Chris, thanks so much for sharing this code. It works like a charm!!

                  Dear customer service, I would like to put in a request to for Ninjatrader to modify the code of the line tool according to the code above, as the current Shift + line tool does not snap the line into a horizontal line. For the 45 line, work still needs to be done to snap it correctly.


                  Comment


                    #10
                    Originally posted by NinjaTrader_Alaura View Post
                    Hello ChrisR,

                    Thank you for reaching out; glad to assist!

                    I have tested this within my installation and I am unable to replicate this behavior as it appears to be working for me. Tested various settings that I thought may affect it and still no issue.

                    Can you create a new workspace named ' Test ' > Open a single chart and test once again. If there is still an issue, please save the workspace and send it to us at support[AT]ninjatrader[DOT]com so we can test on our end.​

                    Thank you for your use of NinjaTrader!
                    Hi Alaura,

                    Seems like all of us here are experiencing this bug except for yourself. I am on version 8.1.1.7. I shall share how I encountered this bug so you can replicate this yourself:

                    1. Click on a line tool (not horizontal line too), or press F2 to use line tool
                    2. When the pencil icon appears, click somewhere on a chart
                    3. Press hold the SHIFT key
                    4. While holding the SHIFT key, pull the pencil to the right, at an angle of about 10 to 20 degrees to the starting point of the line, so now the pencil is above the drawn line, but a horizontal line is still being drawn
                    5. While pressing the SHIFT key, click on the chart again. The line is now a slanted line instead of a horizontal line.

                    If snaping is really occurring, then a horizontal line should be drawn.

                    This is not a workspace issue as a freshly-installed copy of NT8 will give the same problem.

                    The code added by ChrisR in post 8 above solves this problem by drawing a perfect horizontal line. To check, just right-click on the properties of the line, the "Start Y" and "End Y" values are exactly the same.

                    In (4) above, if you angle your pencil closer to 45 degrees, a 45-degree line will be drawn but the bug prevents it from snapping into a 45-degree line.
                    As for the 45 degree line, Chris R's code doesn't resolve it so more modification is needed to snap it properly into a 45 degrees line.

                    Last edited by Rainmakersg; 08-10-2023, 09:56 PM.

                    Comment


                      #11
                      Hello Everyone,

                      Thank you for reporting this behavior.

                      After some additional testing, we were also able to replicate this behavior.

                      The Development team has already implemented the change and this should be included in the next update to NinjaTrader 8.

                      Unfortunately, we cannot say for sure when that will be released, but you are welcome to subscribe to the "News and Announcements" forum page to get a notification any time we post about an update or something else in there.
                      Thank you again everyone for reporting this behavior and Rainmakersg for providing thorough step-by-step instructions on how to replicate it.

                      Please let us know if we may provide any further assistance.
                      Clayton G.NinjaTrader Customer Service

                      Comment


                        #12
                        if anyone is trying to find the file Lines.cs, go to "Documents\NinjaTrader 8\bin\Custom\DrawingTools"

                        Comment


                          #13
                          Hi there - I'm new to NT but have used many other platforms in the past 10+ years. I don't really understand why this is even an issue. I use a horizontal point-to-point line constantly on my charts, and the fact that it's not just a simple part of the drawing tools is frustrating. Is this what I should expect going forward with NT - that to make tools work we need to track down scripts and edit outside of NT then recompile the code, etc? Seems that this thread and others with the same issue/request have been ongoing for years. I'm running 8.1.2.0 - Why is this not part of the suite of tools available by default?

                          Comment


                            #14
                            Originally posted by Rainmakersg View Post

                            Hi Alaura,

                            Seems like all of us here are experiencing this bug except for yourself. I am on version 8.1.1.7. I shall share how I encountered this bug so you can replicate this yourself:

                            1. Click on a line tool (not horizontal line too), or press F2 to use line tool
                            2. When the pencil icon appears, click somewhere on a chart
                            3. Press hold the SHIFT key
                            4. While holding the SHIFT key, pull the pencil to the right, at an angle of about 10 to 20 degrees to the starting point of the line, so now the pencil is above the drawn line, but a horizontal line is still being drawn
                            5. While pressing the SHIFT key, click on the chart again. The line is now a slanted line instead of a horizontal line.

                            If snaping is really occurring, then a horizontal line should be drawn.

                            This is not a workspace issue as a freshly-installed copy of NT8 will give the same problem.

                            The code added by ChrisR in post 8 above solves this problem by drawing a perfect horizontal line. To check, just right-click on the properties of the line, the "Start Y" and "End Y" values are exactly the same.

                            In (4) above, if you angle your pencil closer to 45 degrees, a 45-degree line will be drawn but the bug prevents it from snapping into a 45-degree line.
                            As for the 45 degree line, Chris R's code doesn't resolve it so more modification is needed to snap it properly into a 45 degrees line.
                            Used your code but added a piece to solve the annoying error where the line snaps to a wrong endpoint even when holding the shift:

                            THIS ONLY WORKS FOR THE HORIZONTALE LINE. (Trying the 45degrees will snap it horizontale)

                            Change it as Rainmakersg said beginning on line 448 in the file Lines.cs, go to "Documents\NinjaTrader 8\bin\Custom\DrawingTools"

                            Code:
                            else if (EndAnchor.IsEditing)
                            {
                            dataPoint.CopyDataValues(EndAnchor);
                            EndAnchor.IsEditing = false;
                            
                            if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                            {
                            EndAnchor.Price = StartAnchor.Price;
                            }
                            }​

                            Then also change from line 521 to:

                            Code:
                            else if (LineType != ChartLineType.VerticalLine)
                            {
                            // horizontal line only needs Y value updated
                            editingAnchor.Price = dataPoint.Price;
                            EndAnchor.Price = dataPoint.Price;
                            if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                            {
                            EndAnchor.Price = StartAnchor.Price;
                            }
                            }​
                            Let me know if you like it or not Collecting likes :thumb:
                            Last edited by Creamers; 02-19-2024, 11:24 AM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by f.saeidi, Today, 05:56 AM
                            1 response
                            3 views
                            0 likes
                            Last Post Jltarrau  
                            Started by Jltarrau, Today, 05:57 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post Jltarrau  
                            Started by Stanfillirenfro, Yesterday, 09:19 AM
                            7 responses
                            51 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by TraderCro, 04-12-2024, 11:36 AM
                            4 responses
                            70 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Mindset, Yesterday, 02:04 AM
                            1 response
                            15 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Working...
                            X