Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SharpDX Stroke Style

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

    SharpDX Stroke Style

    Hi,

    Is there any way to access the width of a SharpDX stroke style and change it dynamically? For regular strokes we have myStroke.Width. Thanks.

    #2
    Hello Zeos6,

    Thank you for your post.

    StrokeStyle does not contain a width. Generally the object you pass StrokeStyle to will have an overload for the width of the object. For example, the RenderTargetDrawGeometry:
    Code:
    RenderTarget.DrawGeometry(g, Plots[0].BrushDX, Plots[0].Width, Plots[0].StrokeStyle);
    For more information please visit the following link: https://ninjatrader.com/support/help...trokestyle.htm

    Please let me know if you have any questions.

    Comment


      #3
      Hi PatrickH,

      I am aware of the overload. But this means that if I need to adjust the width dynamically I need to add extra code. Awkward to say the least. Let me then ask you this, is there a way to recover the stroke from a stroke style created as myStroke.StrokeStyle, That way I could retrieve the width and create a new stroke style on the fly.

      Comment


        #4
        Hello Zeos6,

        Thank you for your response.

        Can you detail this concept further? DO you have a use case and/or pseudo code that could explain this further?

        I look forward to your response.

        Comment


          #5
          Hi PatrickH,

          The idea is to be able to adjust the width of a SharpDX stroke dynamically. I can create the stroke style once and can reuse it without resorting to OnRenderTargetChanged() to reset the render target for strokes. This is currently creating havoc with some of my indicators, on loading the indicator. The indicators worked perfectly before I upgraded to the latest version of NT. So my thought was to create all my DX brushes and DX strokestyles once and thus not use OnrenderTargetChanged(). It appears that OnRenderTargetChanged() is called even before State = State.Configure where the strokes are initialized.
          Last edited by Zeos6; 06-01-2018, 03:15 PM.

          Comment


            #6
            Hello Zeos6,

            Thank you for your response.

            Can you detail what the behavior was with OnRenderTargetChanged() before the update and what you are seeing not with the new release of NinjaTrader 8?

            Any code you can provide to explain what you were doing that was working but does not work now will be most helpful.

            I look forward to your response.

            Comment


              #7
              Hi PatrickH,

              Thank you for your response.
              I don't want to duplicate efforts. I have detailed this in the following thread:

              ChrisL answered me earlier but I am not sure if he is still following up on this.

              However, there is one aspect that I did not address with ChrisL that you might be able to answer for me. It appears that in the new version of NT, OnRenderTargetChanged() gets executed before State == State.Configure. This means that DX brushes and strokes can no longer be reused as before since brushes and strokes are null until State.Configure is run. Therefore, can you please explain to me how to reuse DX brushes and strokes under the new version of NT?

              As an aside, can you guys also add some color/brush helper methods to your DX extensions so that we can create DX brushes without the need for RenderTarget? I've had to write my own, but it would be helpful.

              Thank you very much PatrickH.

              EDIT: More specifically, and I have just verified it...
              In the last version of NT (R 13), the order of execution was

              State == State.Configure
              OnRenderTargetChanged()

              In R 14 of NT (current version), the execution order is
              OnRenderTargetChanged()
              State == State.Configure

              Because of this change, DX brushes and strokes can no longer be reused as they haven't been configured yet.
              Last edited by Zeos6; 06-04-2018, 01:19 PM.

              Comment


                #8
                Hello Zeos6,

                I will answer any additional questions about this on this forum thread:

                Comment


                  #9
                  Hello Zeos6,

                  Thank you for your response.

                  I would like to forward the following as a feature request to our development team. Can you provide a use case and an example in code of one of these helper methods?
                  Originally posted by Zeos6 View Post
                  As an aside, can you guys also add some color/brush helper methods to your DX extensions so that we can create DX brushes without the need for RenderTarget? I've had to write my own, but it would be helpful.

                  Comment


                    #10
                    Hi PatrickH,

                    The methods are an adaptation of the methods provided by another user in the following threads:


                    I think the comments from Sim22 and gregid should be a great starting point.

                    Comment


                      #11
                      Hello Zeos6,

                      Thank you for your response.

                      I will forward this to development as a feature request.

                      Comment


                        #12
                        Hello Zeos6,

                        Thank you for your patience.

                        Your request for the Helper Methods has been assigned the internal tracking id of SFT-3266.

                        Please let me know if you have any questions.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        566 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        330 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        101 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        547 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        548 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X