Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rotating Chat Markers

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

    Rotating Chat Markers

    Hello,

    Is it possible to rotate chart markers by code?
    Unsuitable
    NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

    #2
    Hello Unsuitable,

    Thank you for your reply.

    I'm not sure which chart markers you're referring to - do you mean like drawing objects, or the arrows and text that show when a position is entered or exited? When you say rotate them, can you give a little more detail on how you'd want to manipulate them?

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello Unsuitable,

      Thank you for your reply.

      I'm not sure which chart markers you're referring to - do you mean like drawing objects, or the arrows and text that show when a position is entered or exited? When you say rotate them, can you give a little more detail on how you'd want to manipulate them?

      Thanks in advance; I look forward to assisting you further.
      Talking about this
      Attached Files
      Unsuitable
      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

      Comment


        #4
        Hello Unsuitable,

        Thank you for your reply.

        You could certainly create a custom version of the ChartMarkers drawing tools with rotated versions. I'd take a look at that original script (under Drawing Tools in the NinjaScript Editor). Looks like this version pretty much draws the same thing whether it's an up or down triangle, so you could experiment around adding a ArrowLeft or ArrowRight. The lines that actually do the transforming to make it point up or down look to be around line 384 to 390, so you might not have to reinvent the wheel here to accomplish that.

        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Hello Kate,

          Lines 384 to 390 refer to the arrow up, lines 499 to 502 are the triangle code. It's the same code though. I'm not familiar with SharpDX. Would it be possible to apply a new transform matrix onto an existing chart marker object or does it have to be applied while it's building the object?

          Tried this

          Code:
          triangleUpObject.RenderTarget.Transform = SharpDX.Matrix3x2.Rotation(NinjaTrader.NinjaScript.DrawingTools.DrawingTool.MathHelper.DegreesToRadians(90), SharpDX.Vector2.Zero) * SharpDX.Matrix3x2.Translation(triangleUpObject.Anchor.GetPoint.ToVector2());
          The .GetPoint is having trouble. It wants arguments ie ChartControl, Panel, ChartScale. Assuming what I'm doing works, how does one get those variables in this context?
          Unsuitable
          NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

          Comment


            #6
            Hello Unsuitable,

            Thank you for your reply.

            My mistake there. I've actually created a quick version of this with just left and right arrows - the other chart markers are stripped out. Basically, we use the same code to draw the triangles, and then just rotate that depending on the necessary direction:

            Code:
            // the geometry is created with 0,0 as point origin, and pointing UP by default.
            // so translate & rotate as needed
            SharpDX.Matrix3x2 transformMatrix;
            
            if (IsLeftTriangle)
            transformMatrix = SharpDX.Matrix3x2.Rotation(MathHelper.DegreesToRad ians(270), SharpDX.Vector2.Zero) * SharpDX.Matrix3x2.Translation(endVector);
            else
            transformMatrix = SharpDX.Matrix3x2.Rotation(MathHelper.DegreesToRad ians(90), SharpDX.Vector2.Zero) * SharpDX.Matrix3x2.Translation(endVector);
            You can find the version I've created below, which should help some with rotating any other chart marker objects to make your own versions.

            Please let us know if we may be of further assistance to you.
            Attached Files

            Comment


              #7
              Also, another solution you may consider - using text and font with the symbols, where you can "draw" (type) any symbol that is in that font.

              Comment


                #8
                Originally posted by UltraNIX View Post
                Also, another solution you may consider - using text and font with the symbols, where you can "draw" (type) any symbol that is in that font.
                May just do that as that's much more straightforward and require less code. For my custom text button indicator, there's a feature to add modifiers to the texts. So if the user wants to point to something specific then the user can add directional text characters.
                Unsuitable
                NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                Comment


                  #9
                  Thank you Kate for the reply.

                  Is it possible to apply a new transform matrix to an existing triangle chart marker? I would like to avoid copying the entire code into the indicator. From how it's codded. the transform matrix can be added up.

                  Code:
                  ChartPanel panel = chartControl.ChartPanels[chartScale.PanelIndex];
                  Point pixelPoint = trangleUpDrawObject.Anchor.GetPoint(chartControl, panel, chartScale);
                  SharpDX.Vector2 endVector = pixelPoint.ToVector2();
                  
                  transformMatrix = SharpDX.Matrix3x2.Rotation(MathHelper.DegreesToRadians(90), SharpDX.Vector2.Zero) * SharpDX.Matrix3x2.Translation(endVector);
                  SharpDX.Matrix3x2 transformMatrix;
                  
                  trangleUpDrawObject.RenderTarget.Transform = transformMatrix
                  The chartControl, and chartScale were variables obtain from calling the OnRender method. How does one obtain in this context?
                  Unsuitable
                  NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                  Comment


                    #10
                    Hello Unsuitable,

                    Thank you for your reply.

                    I'm not sure I follow - you'd simply make a rotated version of the drawing tool like my example above that you could then use in whatever script you like, you wouldn't need to copy a bunch of code into an indicator each time you want to use it so you don't have to mess around rotating it in every script you want that way.

                    Please let us know if we may be of further assistance to you.

                    Comment


                      #11
                      Hello Kate,

                      While creating another script and using it to draw the chart marker from whatever script I want is a solution, I want to avoid using helper scripts. Thus a possible solution would be to draw a chart marker triangle, get the object, then rotate it. I'm asking if that's possible?

                      Code:
                      NinjaTrader.NinjaScript.DrawingTools.TriangleUp triangleUpObject = DrawObjects["TriangleUpID"];
                      triangleUpObject.RenderTarget.Transform = **Code to add rotation**;
                      This property RenderTarget.Transform property is accessible and can be set. Based on the script you provided, transform Matixs are added up together. In the script you provided (line 216), this is how to do it.

                      Code:
                      SharpDX.Matrix3x2 transformMatrix;
                      
                      transformMatrix = SharpDX.Matrix3x2.Rotation(MathHelper.DegreesToRadians(270), SharpDX.Vector2.Zero) * SharpDX.Matrix3x2.Translation(endVector);
                      Then it is set (line 222)

                      Code:
                      RenderTarget.Transform = transformMatrix;
                      Where I'm having trouble is with the endVector variable from line 216. The variable is based on lines 208-210. Where do we get "chartControl" and "chartScale" from within my indicator?

                      Code:
                      ChartPanel panel = chartControl.ChartPanels[chartScale.PanelIndex];
                      Point pixelPoint = Anchor.GetPoint(chartControl, panel, chartScale);
                      SharpDX.Vector2 endVector = pixelPoint.ToVector2();
                      Unsuitable
                      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                      Comment


                        #12
                        Hello Unsuitable,

                        Thank you for your reply.

                        While creating another script and using it to draw the chart marker from whatever script I want is a solution, I want to avoid using helper scripts. Thus a possible solution would be to draw a chart marker triangle, get the object, then rotate it. I'm asking if that's possible?
                        No, that would not be possible.

                        I've run this by our team lead and he concurs with my assessment that you would have to clone or extend the Chart Markers drawing tool, like my above example or like this Chart Markers Plus drawing tool suite from our publicly available User App Share:

                        These are duplicate chart markers to what comes with the platform except you can change the size of them. The existing chart markers will remain as well. This will allow you to create custom sized chart markers that you can create and save as default so that you can draw the markers as needed to […]


                        Then you can add code to rotate and render in which ever direction you want, or for example add a public property that controls the direction of the drawing object in question.

                        Please let us know if we may be of further assistance to you.

                        Comment


                          #13
                          Hello Kate,

                          Gotcha, thank you for the confirmation.

                          Since only the draw method is needed, I will try to strip down the code as much as possible. Is that a good idea?
                          Unsuitable
                          NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                          Comment


                            #14
                            Hello Unsuitable,

                            Thank you for your reply.

                            The code in my example is about as stripped down as it can be for a custom drawing tool, but you're welcome to make any modifications you like to a script.

                            Please let us know if we may be of further assistance to you.

                            Comment


                              #15
                              Hello Kate,

                              The goal is to strip it down so it's only the right triangle with only the ability to draw it from code. Overall I'm attempting to improve the Order Transfer indicator. This indicator, for example, takes trades from the MES and then places the execution markers on the ES. Of course, these markets are not 1:1, but it's better than manually drawing the entry/exit orders every time.

                              Thanks for all the help!
                              Unsuitable
                              NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              647 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              368 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              571 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X